{"id":1015,"date":"2010-07-14T22:30:21","date_gmt":"2010-07-14T21:30:21","guid":{"rendered":"http:\/\/thekua.com\/atwork\/?p=1015"},"modified":"2020-05-29T09:57:16","modified_gmt":"2020-05-29T07:57:16","slug":"executable-war-in-maven","status":"publish","type":"post","link":"https:\/\/thekua.com\/atwork\/2010\/07\/executable-war-in-maven\/","title":{"rendered":"Executable War in Maven"},"content":{"rendered":"<p>One of the many issues I had (have) with Maven is finding out how to use an appropriate plugin. The site documentation is normally pretty obscure, and examples are sparse. One of the activites we needed to do recently is to turn our <a href=\"http:\/\/docs.oracle.com\/javaee\/1.4\/tutorial\/doc\/WebApp3.html\">war<\/a> artifact into something that would run standalone. I&#8217;d normally use something like <a href=\"http:\/\/www.eclipse.org\/jetty\/\">jetty<\/a> for this but I didn&#8217;t find a way to easy bundle jetty and refer to the war within the same classpath (and still have things work). <\/p>\n<p>Another tool I stumbled across was <a href=\"http:\/\/winstone.sourceforge.net\/\">winstone<\/a> (<a href=\"https:\/\/web.archive.org\/web\/20191118040252\/http:\/\/www.hudson-ci.org:80\/\">Hudson<\/a> uses this beast). Wrapping this up seemed pretty easy enough. Note that the configuration below is used to start a war that won&#8217;t have dynamic JSP compilation. If you do, you can add a <code>useJasper=true<\/code> configuration and add the appropriate maven dependencies for jasper to ensure they&#8217;re available. <\/p>\n<p>The result of this plugin will effectively build an executable jar, that you simply start up. <\/p>\n<p>Need to add these dependencies:<\/p>\n<p>Given that your project is a war package as well<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&amp;amp;lt;plugin&amp;amp;gt;\r\n\t&amp;amp;lt;groupId&amp;amp;gt;net.sf.alchim&amp;amp;lt;\/groupId&amp;amp;gt;\r\n\t&amp;amp;lt;artifactId&amp;amp;gt;winstone-maven-plugin&amp;amp;lt;\/artifactId&amp;amp;gt;\r\n\t&amp;amp;lt;executions&amp;amp;gt;\r\n\t\t&amp;amp;lt;execution&amp;amp;gt;\r\n\t\t\t&amp;amp;lt;goals&amp;amp;gt;\r\n\t\t\t\t&amp;amp;lt;goal&amp;amp;gt;embed&amp;amp;lt;\/goal&amp;amp;gt;\r\n\t\t\t&amp;amp;lt;\/goals&amp;amp;gt;\r\n\t\t\t&amp;amp;lt;phase&amp;amp;gt;package&amp;amp;lt;\/phase&amp;amp;gt;\r\n\t\t&amp;amp;lt;\/execution&amp;amp;gt;\r\n\t&amp;amp;lt;\/executions&amp;amp;gt;\r\n\t&amp;amp;lt;configuration&amp;amp;gt;\r\n\t\t&amp;amp;lt;filename&amp;amp;gt;executableWebApplication.jar&amp;amp;lt;\/filename&amp;amp;gt;\r\n\t&amp;amp;lt;\/configuration&amp;amp;gt;\r\n&amp;amp;lt;\/plugin&amp;amp;gt;\r\n<\/pre>\n<p>You will find this artifact built in your standard <code>target<\/code> directly. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of the many issues I had (have) with Maven is finding out how to use an appropriate plugin. The site documentation is normally pretty obscure, and examples are sparse. One of the activites we needed to do recently is to turn our war artifact into something that would run standalone. I&#8217;d normally use something [&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-1015","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.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Executable War in 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\/executable-war-in-maven\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Executable War in Maven - patkua@work\" \/>\n<meta property=\"og:description\" content=\"One of the many issues I had (have) with Maven is finding out how to use an appropriate plugin. The site documentation is normally pretty obscure, and examples are sparse. One of the activites we needed to do recently is to turn our war artifact into something that would run standalone. I&#8217;d normally use something [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thekua.com\/atwork\/2010\/07\/executable-war-in-maven\/\" \/>\n<meta property=\"og:site_name\" content=\"patkua@work\" \/>\n<meta property=\"article:published_time\" content=\"2010-07-14T21:30:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-05-29T07:57:16+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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/executable-war-in-maven\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/executable-war-in-maven\\\/\"},\"author\":{\"name\":\"Patrick\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#\\\/schema\\\/person\\\/c942203c9ed3ff9e21c6c49a996ea3ae\"},\"headline\":\"Executable War in Maven\",\"datePublished\":\"2010-07-14T21:30:21+00:00\",\"dateModified\":\"2020-05-29T07:57:16+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/executable-war-in-maven\\\/\"},\"wordCount\":339,\"commentCount\":4,\"keywords\":[\"Maven\"],\"articleSection\":[\"Development\",\"Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/executable-war-in-maven\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/executable-war-in-maven\\\/\",\"url\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/executable-war-in-maven\\\/\",\"name\":\"Executable War in Maven - patkua@work\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#website\"},\"datePublished\":\"2010-07-14T21:30:21+00:00\",\"dateModified\":\"2020-05-29T07:57:16+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/#\\\/schema\\\/person\\\/c942203c9ed3ff9e21c6c49a996ea3ae\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/executable-war-in-maven\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/executable-war-in-maven\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/2010\\\/07\\\/executable-war-in-maven\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/thekua.com\\\/atwork\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Executable War in 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":"Executable War in 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\/executable-war-in-maven\/","og_locale":"en_US","og_type":"article","og_title":"Executable War in Maven - patkua@work","og_description":"One of the many issues I had (have) with Maven is finding out how to use an appropriate plugin. The site documentation is normally pretty obscure, and examples are sparse. One of the activites we needed to do recently is to turn our war artifact into something that would run standalone. I&#8217;d normally use something [&hellip;]","og_url":"https:\/\/thekua.com\/atwork\/2010\/07\/executable-war-in-maven\/","og_site_name":"patkua@work","article_published_time":"2010-07-14T21:30:21+00:00","article_modified_time":"2020-05-29T07:57:16+00:00","author":"Patrick","twitter_card":"summary_large_image","twitter_creator":"@patkua","twitter_site":"@patkua","twitter_misc":{"Written by":"Patrick","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thekua.com\/atwork\/2010\/07\/executable-war-in-maven\/#article","isPartOf":{"@id":"https:\/\/thekua.com\/atwork\/2010\/07\/executable-war-in-maven\/"},"author":{"name":"Patrick","@id":"https:\/\/thekua.com\/atwork\/#\/schema\/person\/c942203c9ed3ff9e21c6c49a996ea3ae"},"headline":"Executable War in Maven","datePublished":"2010-07-14T21:30:21+00:00","dateModified":"2020-05-29T07:57:16+00:00","mainEntityOfPage":{"@id":"https:\/\/thekua.com\/atwork\/2010\/07\/executable-war-in-maven\/"},"wordCount":339,"commentCount":4,"keywords":["Maven"],"articleSection":["Development","Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thekua.com\/atwork\/2010\/07\/executable-war-in-maven\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thekua.com\/atwork\/2010\/07\/executable-war-in-maven\/","url":"https:\/\/thekua.com\/atwork\/2010\/07\/executable-war-in-maven\/","name":"Executable War in Maven - patkua@work","isPartOf":{"@id":"https:\/\/thekua.com\/atwork\/#website"},"datePublished":"2010-07-14T21:30:21+00:00","dateModified":"2020-05-29T07:57:16+00:00","author":{"@id":"https:\/\/thekua.com\/atwork\/#\/schema\/person\/c942203c9ed3ff9e21c6c49a996ea3ae"},"breadcrumb":{"@id":"https:\/\/thekua.com\/atwork\/2010\/07\/executable-war-in-maven\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thekua.com\/atwork\/2010\/07\/executable-war-in-maven\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/thekua.com\/atwork\/2010\/07\/executable-war-in-maven\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thekua.com\/atwork\/"},{"@type":"ListItem","position":2,"name":"Executable War in 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\/1015","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=1015"}],"version-history":[{"count":7,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts\/1015\/revisions"}],"predecessor-version":[{"id":3588,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/posts\/1015\/revisions\/3588"}],"wp:attachment":[{"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/media?parent=1015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/categories?post=1015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thekua.com\/atwork\/wp-json\/wp\/v2\/tags?post=1015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}