{"id":504,"date":"2014-04-16T21:42:03","date_gmt":"2014-04-17T02:42:03","guid":{"rendered":"http:\/\/tiemensfamily.com\/TimOnCS\/?p=504"},"modified":"2014-04-16T21:42:03","modified_gmt":"2014-04-17T02:42:03","slug":"gradle-with-local-archiva","status":"publish","type":"post","link":"https:\/\/tiemensfamily.com\/timoncs\/2014\/04\/16\/gradle-with-local-archiva\/","title":{"rendered":"Gradle with Local Archiva"},"content":{"rendered":"<p>This shows the way to get gradle to use a local Archiva server to resolve dependencies (where the Archiva server in turn resolves to maven central).<\/p>\n<p>(Side comment: documentation for gradle is sparse, incomplete and out-of-date &#8211; e.g. &#8216;mavenRepo&#8217; shows up in many searches.)<\/p>\n<p>So, if you&#8217;re interested in how to use a local Apache Archiva server in your environment, then this shows the correct &#8216;repositories&#8217; section of your build.gradle file.  In an upcoming post, I&#8217;ll document how to publish to your local Archiva server.  Feel free to substitute &#8220;localhost&#8221; for the actual machine name or IP address of your Archiva server.<\/p>\n<p>Versions:<br \/>\narchiva: 2.0.1<br \/>\ngradle: 1.10<\/p>\n<pre class=\"prettyprint\">\nrepositories {\n   maven {\n     url 'http:\/\/localhost:8080\/repository\/internal'\n   }\n   maven {\n     url 'http:\/\/localhost:8080\/repository\/snapshots'\n   }\n\n  \/\/ if your Archiva is set up correctly, \n  \/\/ then you don't need mavenCentral() here:\n  \/\/  mavenCentral()\n}\n<\/pre>\n<p>Just for documentation, this shows the &#8220;dependencies&#8221; section of the build.gradle file.  If your Archiva is set up correctly, these 3 dependencies will actually download\/store 8 .jar files (because of transitive dependencies).<\/p>\n<pre class=\"prettyprint\">\ndependencies {\n  testCompile group: 'info.cukes',   name: 'cucumber-java',    version: '1.1.5'\n  testCompile group: 'info.cukes',   name: 'cucumber-junit',   version: '1.1.5'\n  testCompile group: 'junit',        name: 'junit',            version: '4+'\n}\n<\/pre>\n<p>Files that end up in your apache-archiva\/repositories directory (showing just the .jar files):<\/p>\n<pre>\napache-archiva-2.0.1\/repositories\/internal\/junit\/junit\/4.11\/junit-4.11.jar\napache-archiva-2.0.1\/repositories\/internal\/org\/hamcrest\/hamcrest-core\/1.3\/hamcrest-core-1.3.jar\napache-archiva-2.0.1\/repositories\/internal\/info\/cukes\/cucumber-html\/0.2.3\/cucumber-html-0.2.3.jar\napache-archiva-2.0.1\/repositories\/internal\/info\/cukes\/cucumber-java\/1.1.5\/cucumber-java-1.1.5.jar\napache-archiva-2.0.1\/repositories\/internal\/info\/cukes\/gherkin\/2.12.1\/gherkin-2.12.1.jar\napache-archiva-2.0.1\/repositories\/internal\/info\/cukes\/cucumber-junit\/1.1.5\/cucumber-junit-1.1.5.jar\napache-archiva-2.0.1\/repositories\/internal\/info\/cukes\/cucumber-jvm-deps\/1.0.3\/cucumber-jvm-deps-1.0.3.jar\napache-archiva-2.0.1\/repositories\/internal\/info\/cukes\/cucumber-core\/1.1.5\/cucumber-core-1.1.5.jar\n<\/pre>\n<p>Documentation &#8211; The good stuff:<br \/>\n<a href=\"http:\/\/www.gradle.org\/docs\/1.8-rc-1\/release-notes.html\">http:\/\/www.gradle.org\/docs\/1.8-rc-1\/release-notes.html<\/a> &#8212; shows the change from mavenRepo to maven.<br \/>\n<a href=\"http:\/\/gradleproject.wordpress.com\/2013\/02\/14\/multiple-maven-repositories-in-gradle\/\">http:\/\/gradleproject.wordpress.com\/2013\/02\/14\/multiple-maven-repositories-in-gradle\/<\/a> &#8211; now NOT to set up your repositories entry.<\/p>\n<p>More Documentation &#8211; The list of things that don&#8217;t work:<br \/>\n<a href=\"http:\/\/gradle.1045684.n5.nabble.com\/using-Archiva-maven-repo-w-Gradle-td4579298.html\">http:\/\/gradle.1045684.n5.nabble.com\/using-Archiva-maven-repo-w-Gradle-td4579298.html<\/a><br \/>\n<a href=\"http:\/\/joshdiehl.com\/2011\/07\/11\/using-apache-archiva-with-gradle\/\">http:\/\/joshdiehl.com\/2011\/07\/11\/using-apache-archiva-with-gradle\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This shows the way to get gradle to use a local Archiva server to resolve dependencies (where the Archiva server in turn resolves to maven central). (Side comment: documentation for gradle is sparse, incomplete and out-of-date &#8211; e.g. &#8216;mavenRepo&#8217; shows &hellip; <a href=\"https:\/\/tiemensfamily.com\/timoncs\/2014\/04\/16\/gradle-with-local-archiva\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts\/504"}],"collection":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/comments?post=504"}],"version-history":[{"count":0,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts\/504\/revisions"}],"wp:attachment":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/media?parent=504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/categories?post=504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/tags?post=504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}