{"id":265,"date":"2008-08-18T06:30:14","date_gmt":"2008-08-18T05:30:14","guid":{"rendered":"http:\/\/thekua.com\/atwork\/2008\/08\/18\/maven-faq\/"},"modified":"2008-08-18T06:40:28","modified_gmt":"2008-08-18T05:40:28","slug":"maven-faq","status":"publish","type":"post","link":"https:\/\/thekua.com\/atwork\/2008\/08\/maven-faq\/","title":{"rendered":"Maven FAQ"},"content":{"rendered":"<p><a href=\"http:\/\/maven.apache.org\/\">Maven<\/a> only has 20 FAQs on its page <a href=\"http:\/\/maven.apache.org\/general.html\">here<\/a>. I&#8217;ve been working with it on a project recently, and frankly I had plenty more than 20 to ask. Here&#8217;s my list of a few things that I hope will help people when they&#8217;re searching for answers not described well in the Maven documentation.<\/p>\n<p><strong>How do I get a plain file (*.txt) included into my deployment file (i.e. jar, war, ear)?<\/strong><br \/>\nMaven&#8217;s default file structure looks like<em> ${projectBase}\/src\/main<\/em>. The compile target looks for production code under <em>${projectBase}\/src\/main\/java<\/em>. It looks for other files to include with your production deployment in <em>${projectBase}\/src\/main\/resources<\/em>. Adding your file to that directory will automatically include them in your deployment file.<\/p>\n<p><strong>When Maven downloads its dependencies, where does it store those files on a windows machine?<\/strong><br \/>\nLook for files under <em>C:\\Documents and Settings\\${userName}\\.m2\\repository<\/em>. <\/p>\n<p><strong>Why doesn&#8217;t a feature from JDK5 or 6 work?<\/strong><br \/>\nBy default, Maven compiles against JDK1.3. Set the source and target JDK where you have your compile target:<\/p>\n<blockquote><p>&lt;plugin&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;configuration&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;source&gt;<strong>1.5<\/strong>&lt;\/source&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;target&gt;<strong>1.5<\/strong>&lt;\/target&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/configuration&gt;<br \/>\n&lt;\/plugin&gt;<\/p><\/blockquote>\n<p><strong>How can I create a single deployment file with all dependent libraries merged?<\/strong><br \/>\nInstead of using the <code>maven-jar-plugin<\/code> plugin, use the <code>maven-assembly-plugin<\/code>. Here&#8217;s an example<\/p>\n<blockquote><p>\n&lt;plugin&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;artifactId&gt;maven-assembly-plugin&lt;\/artifactId&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;configuration&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;descriptorRefs&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;descriptorRef&gt;jar-with-dependencies&lt;\/descriptorRef&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/descriptorRefs&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;archive&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;manifest&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;mainClass&gt;com.thekua.spikes.App&lt;\/mainClass&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/manifest&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/archive&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/configuration&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;executions&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;execution&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;id&gt;make-assembly&lt;\/id&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;phase&gt;package&lt;\/phase&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;goals&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;goal&gt;attached&lt;\/goal&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/goals&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/execution&gt;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/executions&gt;<br \/>\n&lt;\/plugin&gt;\n<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Maven only has 20 FAQs on its page here. I&#8217;ve been working with it on a project recently, and frankly I had plenty more than 20 to ask. Here&#8217;s my list of a few things that I hope will help people when they&#8217;re searching for answers not described well in the Maven documentation. How do [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[],"class_list":["post-265","post","type-post","status-publish","format-standard","hentry","category-java","post-preview"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Maven FAQ - 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\/2008\/08\/maven-faq\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Maven FAQ - patkua@work\" \/>\n<meta property=\"og:description\" content=\"Maven only has 20 FAQs on its page here. I&#8217;ve been working with it on a project recently, and frankly I had plenty more than 20 to ask. Here&#8217;s my list of a few things that I hope will help people when they&#8217;re searching for answers not described well in the Maven documentation. How do [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thekua.com\/atwork\/2008\/08\/maven-faq\/\" \/>\n<meta property=\"og:site_name\" content=\"patkua@work\" \/>\n<meta property=\"article:published_time\" content=\"2008-08-18T05:30:14+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2008-08-18T05:40:28+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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2008\\\/08\\\/maven-faq\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2008\\\/08\\\/maven-faq\\\/\"},\"author\":{\"name\":\"Patrick\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#\\\/schema\\\/person\\\/c942203c9ed3ff9e21c6c49a996ea3ae\"},\"headline\":\"Maven FAQ\",\"datePublished\":\"2008-08-18T05:30:14+00:00\",\"dateModified\":\"2008-08-18T05:40:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2008\\\/08\\\/maven-faq\\\/\"},\"wordCount\":599,\"commentCount\":0,\"articleSection\":[\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thekua.com\\\/atwork\\\/2008\\\/08\\\/maven-faq\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2008\\\/08\\\/maven-faq\\\/\",\"url\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2008\\\/08\\\/maven-faq\\\/\",\"name\":\"Maven FAQ - patkua@work\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#website\"},\"datePublished\":\"2008-08-18T05:30:14+00:00\",\"dateModified\":\"2008-08-18T05:40:28+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#\\\/schema\\\/person\\\/c942203c9ed3ff9e21c6c49a996ea3ae\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2008\\\/08\\\/maven-faq\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thekua.com\\\/atwork\\\/2008\\\/08\\\/maven-faq\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2008\\\/08\\\/maven-faq\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Maven FAQ\"}]},{\"@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":"Maven FAQ - 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\/2008\/08\/maven-faq\/","og_locale":"en_US","og_type":"article","og_title":"Maven FAQ - patkua@work","og_description":"Maven only has 20 FAQs on its page here. I&#8217;ve been working with it on a project recently, and frankly I had plenty more than 20 to ask. Here&#8217;s my list of a few things that I hope will help people when they&#8217;re searching for answers not described well in the Maven documentation. How do [&hellip;]","og_url":"https:\/\/thekua.com\/atwork\/2008\/08\/maven-faq\/","og_site_name":"patkua@work","article_published_time":"2008-08-18T05:30:14+00:00","article_modified_time":"2008-08-18T05:40:28+00:00","author":"Patrick","twitter_card":"summary_large_image","twitter_creator":"@patkua","twitter_site":"@patkua","twitter_misc":{"Written by":"Patrick","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thekua.com\/atwork\/2008\/08\/maven-faq\/#article","isPartOf":{"@id":"https:\/\/thekua.com\/atwork\/2008\/08\/maven-faq\/"},"author":{"name":"Patrick","@id":"https:\/\/thekua.com\/atwork\/#\/schema\/person\/c942203c9ed3ff9e21c6c49a996ea3ae"},"headline":"Maven FAQ","datePublished":"2008-08-18T05:30:14+00:00","dateModified":"2008-08-18T05:40:28+00:00","mainEntityOfPage":{"@id":"https:\/\/thekua.com\/atwork\/2008\/08\/maven-faq\/"},"wordCount":599,"commentCount":0,"articleSection":["Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thekua.com\/atwork\/2008\/08\/maven-faq\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thekua.com\/atwork\/2008\/08\/maven-faq\/","url":"https:\/\/thekua.com\/atwork\/2008\/08\/maven-faq\/","name":"Maven FAQ - patkua@work","isPartOf":{"@id":"https:\/\/thekua.com\/atwork\/#website"},"datePublished":"2008-08-18T05:30:14+00:00","dateModified":"2008-08-18T05:40:28+00:00","author":{"@id":"https:\/\/thekua.com\/atwork\/#\/schema\/person\/c942203c9ed3ff9e21c6c49a996ea3ae"},"breadcrumb":{"@id":"https:\/\/thekua.com\/atwork\/2008\/08\/maven-faq\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thekua.com\/atwork\/2008\/08\/maven-faq\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/thekua.com\/atwork\/2008\/08\/maven-faq\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thekua.com\/atwork\/"},{"@type":"ListItem","position":2,"name":"Maven FAQ"}]},{"@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\/265","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=265"}],"version-history":[{"count":0,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts\/265\/revisions"}],"wp:attachment":[{"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/media?parent=265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/categories?post=265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/tags?post=265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}