{"id":1526,"date":"2022-03-11T16:51:23","date_gmt":"2022-03-11T03:51:23","guid":{"rendered":"https:\/\/www.ronella.xyz\/?p=1526"},"modified":"2022-03-11T16:51:23","modified_gmt":"2022-03-11T03:51:23","slug":"downloading-dependencies-with-gradle-script","status":"publish","type":"post","link":"https:\/\/www.ronella.xyz\/?p=1526","title":{"rendered":"Downloading Dependencies with Gradle Script"},"content":{"rendered":"<ol>\n<li>\n<p><strong>Create settings.gradle file<\/strong> with the following content:<\/p>\n<pre><code class=\"language-groovy\">rootProject.name = 'download-dependecies'<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Create build.gradle file<\/strong> with the following content:<\/p>\n<pre><code class=\"language-groovy\">plugins {\n    id 'application'\n}\n\ngroup 'xyz.ronella.gradle'\nversion '1.0.0'\n\nrepositories {\n    mavenCentral()\n}\n\ndependencies {\n    \/\/Add all the target dependencies here\n    implementation 'org.apache.poi:poi:3.5-FINAL'\n}\n\ntask download(group: 'resolver') {\n    doFirst {\n        ant.delete(dir: 'libs')\n        ant.mkdir(dir: 'libs')\n    }\n    doLast {\n        copy {\n            from sourceSets.main.runtimeClasspath\n            into 'libs\/'\n        }\n        def outputFile = \"${project.buildDir}\\\\${project.name}-${version}.zip\"\n        ant.zip(basedir: \"${file('libs')}\", destfile: \"${outputFile}\", excludes: '*.class')\n        println \"Output: ${outputFile}\"\n        ant.delete(dir: 'libs')\n    }\n}<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>Run<\/strong> the following <strong>gradle command<\/strong>:<\/p>\n<pre><code>gradle download<\/code><\/pre>\n<blockquote>\n<p>If you are using the gradle wrapper, use the following command:<\/p>\n<pre><code>gradlew download<\/code><\/pre>\n<\/blockquote>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Create settings.gradle file with the following content: rootProject.name = &#8216;download-dependecies&#8217; Create build.gradle file with the following content: plugins { id &#8216;application&#8217; } group &#8216;xyz.ronella.gradle&#8217; version &#8216;1.0.0&#8217; repositories { mavenCentral() } dependencies { \/\/Add all the target dependencies here implementation &#8216;org.apache.poi:poi:3.5-FINAL&#8217; } task download(group: &#8216;resolver&#8217;) { doFirst { ant.delete(dir: &#8216;libs&#8217;) ant.mkdir(dir: &#8216;libs&#8217;) } doLast { copy [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[32],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1526"}],"collection":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1526"}],"version-history":[{"count":1,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1526\/revisions"}],"predecessor-version":[{"id":1527,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=\/wp\/v2\/posts\/1526\/revisions\/1527"}],"wp:attachment":[{"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ronella.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}