{"id":1011,"date":"2010-07-15T22:41:01","date_gmt":"2010-07-15T21:41:01","guid":{"rendered":"http:\/\/thekua.com\/atwork\/?p=1011"},"modified":"2010-07-14T17:41:18","modified_gmt":"2010-07-14T16:41:18","slug":"downloading-specific-files-through-maven","status":"publish","type":"post","link":"https:\/\/thekua.com\/atwork\/2010\/07\/downloading-specific-files-through-maven\/","title":{"rendered":"Downloading specific files through Maven"},"content":{"rendered":"<p>In <a href=\"http:\/\/ant.apache.org\/\">ant<\/a>, it&#8217;s pretty easy to use the ant task <a href=\"http:\/\/ant.apache.org\/manual\/Tasks\/get.html\">get<\/a> to download something for you. Apparently it&#8217;s not something most maven users do (probably because they end up doing something like an <a href=\"http:\/\/maven.apache.org\/plugins\/maven-antrun-plugin\/\">ant=run<\/a>). Even though maven has in-built web communications (this is how it often is found downloading the interweb), it wasn&#8217;t easy finding out how to download something not in a maven repository (without having to deploy artefacts into a maven repository which I understand is the &#8220;maven way&#8221;). <\/p>\n<p>Anyway, after sometime, here&#8217;s the plugin configuration I used to do the download. Note that we&#8217;re using Maven 2.1.0 (and it could have changed in the latest version). <\/p>\n<p>The following plugin will download <code><strong>configuration.jar<\/strong><\/code> and <code><strong>artifact.jar<\/strong><\/code> from the web directory <code><strong>http:\/\/host\/pathToArtifact<\/strong><\/code> and drop it into a folder called <code><strong>target\/downloadedFiles<\/strong><\/code>. This does this at the start of the maven lifecycle (note the phase it is attached to below).<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;plugin&gt;\r\n\t&lt;groupId&gt;org.codehaus.mojo&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;wagon-maven-plugin&lt;\/artifactId&gt;\r\n\t&lt;version&gt;1.0-beta-3&lt;\/version&gt;\r\n\t&lt;executions&gt;\r\n\t\t&lt;execution&gt;\r\n\t\t\t&lt;phase&gt;validate&lt;\/phase&gt;\r\n\t\t\t&lt;goals&gt;\r\n\t\t\t\t&lt;goal&gt;download&lt;\/goal&gt;\r\n\t\t\t&lt;\/goals&gt;\r\n\t\t\t&lt;configuration&gt;\r\n\t\t\t\t&lt;url&gt;http:\/\/host\/pathToArtifact&lt;\/url&gt;\r\n\t\t\t\t&lt;includes&gt;\r\n\t\t\t\t\tconfiguration.jar, artifact.jar\r\n\t\t\t\t&lt;\/includes&gt;\r\n\t\t\t\t&lt;toDir&gt;target\/downloadedFiles&lt;\/toDir&gt;\r\n\t\t\t&lt;\/configuration&gt;\r\n\t\t&lt;\/execution&gt;\r\n\t&lt;\/executions&gt;\r\n&lt;\/plugin&gt;<\/pre>\n<p>Some limitations is that it won&#8217;t fail if it can download some of the artifacts and not others. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>In ant, it&#8217;s pretty easy to use the ant task get to download something for you. Apparently it&#8217;s not something most maven users do (probably because they end up doing something like an ant=run). Even though maven has in-built web communications (this is how it often is found downloading the interweb), it wasn&#8217;t easy finding [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,35],"tags":[73],"class_list":["post-1011","post","type-post","status-publish","format-standard","hentry","category-development","category-java","tag-maven","post-preview"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Downloading specific files through Maven - patkua@work<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thekua.com\/atwork\/2010\/07\/downloading-specific-files-through-maven\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Downloading specific files through Maven - patkua@work\" \/>\n<meta property=\"og:description\" content=\"In ant, it&#8217;s pretty easy to use the ant task get to download something for you. Apparently it&#8217;s not something most maven users do (probably because they end up doing something like an ant=run). Even though maven has in-built web communications (this is how it often is found downloading the interweb), it wasn&#8217;t easy finding [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thekua.com\/atwork\/2010\/07\/downloading-specific-files-through-maven\/\" \/>\n<meta property=\"og:site_name\" content=\"patkua@work\" \/>\n<meta property=\"article:published_time\" content=\"2010-07-15T21:41:01+00:00\" \/>\n<meta name=\"author\" content=\"Patrick\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@patkua\" \/>\n<meta name=\"twitter:site\" content=\"@patkua\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Patrick\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/downloading-specific-files-through-maven\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/downloading-specific-files-through-maven\\\/\"},\"author\":{\"name\":\"Patrick\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#\\\/schema\\\/person\\\/c942203c9ed3ff9e21c6c49a996ea3ae\"},\"headline\":\"Downloading specific files through Maven\",\"datePublished\":\"2010-07-15T21:41:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/downloading-specific-files-through-maven\\\/\"},\"wordCount\":271,\"commentCount\":0,\"keywords\":[\"Maven\"],\"articleSection\":[\"Development\",\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/downloading-specific-files-through-maven\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/downloading-specific-files-through-maven\\\/\",\"url\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/downloading-specific-files-through-maven\\\/\",\"name\":\"Downloading specific files through Maven - patkua@work\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#website\"},\"datePublished\":\"2010-07-15T21:41:01+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#\\\/schema\\\/person\\\/c942203c9ed3ff9e21c6c49a996ea3ae\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/downloading-specific-files-through-maven\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/downloading-specific-files-through-maven\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/downloading-specific-files-through-maven\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Downloading specific files through Maven\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#website\",\"url\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/\",\"name\":\"patkua@work\",\"description\":\"The intersection of technology and leadership\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#\\\/schema\\\/person\\\/c942203c9ed3ff9e21c6c49a996ea3ae\",\"name\":\"Patrick\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g\",\"caption\":\"Patrick\"},\"sameAs\":[\"http:\\\/\\\/thekua.com\\\/atwork\"],\"url\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/author\\\/patrick\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Downloading specific files through Maven - patkua@work","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/thekua.com\/atwork\/2010\/07\/downloading-specific-files-through-maven\/","og_locale":"en_US","og_type":"article","og_title":"Downloading specific files through Maven - patkua@work","og_description":"In ant, it&#8217;s pretty easy to use the ant task get to download something for you. Apparently it&#8217;s not something most maven users do (probably because they end up doing something like an ant=run). Even though maven has in-built web communications (this is how it often is found downloading the interweb), it wasn&#8217;t easy finding [&hellip;]","og_url":"https:\/\/thekua.com\/atwork\/2010\/07\/downloading-specific-files-through-maven\/","og_site_name":"patkua@work","article_published_time":"2010-07-15T21:41:01+00:00","author":"Patrick","twitter_card":"summary_large_image","twitter_creator":"@patkua","twitter_site":"@patkua","twitter_misc":{"Written by":"Patrick","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thekua.com\/atwork\/2010\/07\/downloading-specific-files-through-maven\/#article","isPartOf":{"@id":"https:\/\/thekua.com\/atwork\/2010\/07\/downloading-specific-files-through-maven\/"},"author":{"name":"Patrick","@id":"https:\/\/thekua.com\/atwork\/#\/schema\/person\/c942203c9ed3ff9e21c6c49a996ea3ae"},"headline":"Downloading specific files through Maven","datePublished":"2010-07-15T21:41:01+00:00","mainEntityOfPage":{"@id":"https:\/\/thekua.com\/atwork\/2010\/07\/downloading-specific-files-through-maven\/"},"wordCount":271,"commentCount":0,"keywords":["Maven"],"articleSection":["Development","Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thekua.com\/atwork\/2010\/07\/downloading-specific-files-through-maven\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thekua.com\/atwork\/2010\/07\/downloading-specific-files-through-maven\/","url":"https:\/\/thekua.com\/atwork\/2010\/07\/downloading-specific-files-through-maven\/","name":"Downloading specific files through Maven - patkua@work","isPartOf":{"@id":"https:\/\/thekua.com\/atwork\/#website"},"datePublished":"2010-07-15T21:41:01+00:00","author":{"@id":"https:\/\/thekua.com\/atwork\/#\/schema\/person\/c942203c9ed3ff9e21c6c49a996ea3ae"},"breadcrumb":{"@id":"https:\/\/thekua.com\/atwork\/2010\/07\/downloading-specific-files-through-maven\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thekua.com\/atwork\/2010\/07\/downloading-specific-files-through-maven\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/thekua.com\/atwork\/2010\/07\/downloading-specific-files-through-maven\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thekua.com\/atwork\/"},{"@type":"ListItem","position":2,"name":"Downloading specific files through Maven"}]},{"@type":"WebSite","@id":"https:\/\/thekua.com\/atwork\/#website","url":"https:\/\/thekua.com\/atwork\/","name":"patkua@work","description":"The intersection of technology and leadership","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thekua.com\/atwork\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/thekua.com\/atwork\/#\/schema\/person\/c942203c9ed3ff9e21c6c49a996ea3ae","name":"Patrick","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2ef85a5f91c2aac13efb3ac90077b4db7f8883cafd6e60f2bcecba6b092d4011?s=96&d=mm&r=g","caption":"Patrick"},"sameAs":["http:\/\/thekua.com\/atwork"],"url":"https:\/\/thekua.com\/atwork\/author\/patrick\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts\/1011","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/comments?post=1011"}],"version-history":[{"count":3,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts\/1011\/revisions"}],"predecessor-version":[{"id":1022,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts\/1011\/revisions\/1022"}],"wp:attachment":[{"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/media?parent=1011"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/categories?post=1011"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/tags?post=1011"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}