{"id":1557,"date":"2015-03-06T21:35:51","date_gmt":"2015-03-06T20:35:51","guid":{"rendered":"http:\/\/codingexplained.com\/?p=1557"},"modified":"2015-03-06T21:33:53","modified_gmt":"2015-03-06T20:33:53","slug":"moving-ebextensions-root-war-file","status":"publish","type":"post","link":"https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file","title":{"rendered":"Moving .ebextensions to root in .war file"},"content":{"rendered":"<p>If you wish to deploy your application to Amazon&#8217;s Elastic Beanstalk, then\u00a0you can customize your server setup by placing configuration files within a <span class=\"code\">.ebextensions<\/span> directory within the root of your <span class=\"code\">.war<\/span> file (for web applications). These files can then contain various kinds of instructions. One can install packages with package managers such as <span class=\"code\">yum<\/span> or <span class=\"code\">rpm<\/span>. It is also possible to add files or issue commands and more. For an overview of the possibilities, please see the <a title=\"Customizing Elastic Beanstalk EC2 instances\" href=\"http:\/\/docs.aws.amazon.com\/elasticbeanstalk\/latest\/dg\/customize-containers-ec2.html\" target=\"_blank\" rel=\"external nofollow\">official documentation<\/a>.<\/p>\n<p>This article will show you how to place the <span class=\"code\">.ebextensions<\/span> directory at the root of your war file. An easy way of doing this is to package your war file with Maven. This assumes that your project is a Maven project and has a <span class=\"code\">pom.xml<\/span> file at the root of the project.<\/p>\n<p>What you have to do is to instruct the <span class=\"code\">maven-war-plugin<\/span> to move the <span class=\"code\">.ebextensions<\/span> directory to the root of the war file. This can be done like in the below example (within <span class=\"code\">pom.xml<\/span>).<\/p>\n<pre><code>\r\n&lt;plugin&gt;\r\n    &lt;artifactId&gt;maven-war-plugin&lt;\/artifactId&gt;\r\n    &lt;version&gt;2.6&lt;\/version&gt;\r\n    &lt;configuration&gt;\r\n    \t&lt;webResources&gt;\r\n            &lt;resource&gt;\r\n            \t&lt;directory&gt;src\/main\/ebextensions&lt;\/directory&gt;\r\n                &lt;targetPath&gt;.ebextensions&lt;\/targetPath&gt;\r\n                &lt;filtering&gt;true&lt;\/filtering&gt;\r\n            &lt;\/resource&gt;\r\n        &lt;\/webResources&gt;\r\n    &lt;\/configuration&gt;\r\n&lt;\/plugin&gt;\r\n<!--formatted--><\/code>\r\n<\/pre>\n<p>Then, provided that your project is set to use war packaging within your <span class=\"code\">pom.xml<\/span>, you can issue the following command from the Terminal (with the working directory at the project root).<\/p>\n<pre><code>\r\nmvn package\r\n<\/code>\r\n<\/pre>\n<p>This will place a war file at the project&#8217;s target directory with the <span class=\"code\">.ebextensions<\/span> directory at the root. To verify that the directory has been moved correctly, then you can <a title=\"Unpacking War File on OS X and Linux\" href=\"\/coding\/java\/unpacking-war-file-os-x-and-linux\">unpack\u00a0or view\u00a0.war files contents<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you wish to deploy your application to Amazon&#8217;s Elastic Beanstalk, then\u00a0you can customize your server setup by placing configuration files within a .ebextensions directory within the root of your .war file (for web applications). These files can then contain various kinds of instructions. One can install packages with package managers such as yum or&hellip; <a href=\"https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file\" class=\"more-link\">read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[8],"tags":[108,107,109,110,42,106],"series":[],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Moving .ebextensions to root in .war file<\/title>\n<meta name=\"description\" content=\"Moving a .ebextensions to the root of a .war file for use with Amazon&#039;s Elastic Beanstalk is simple. With Maven, this can easily be accomplished.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Moving .ebextensions to root in .war file\" \/>\n<meta property=\"og:description\" content=\"Moving a .ebextensions to the root of a .war file for use with Amazon&#039;s Elastic Beanstalk is simple. With Maven, this can easily be accomplished.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file\" \/>\n<meta property=\"og:site_name\" content=\"Coding Explained\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codingexplained\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/codingexplained\" \/>\n<meta property=\"article:published_time\" content=\"2015-03-06T20:35:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-03-06T20:33:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codingexplained.com\/wp-content\/uploads\/2015\/11\/codingexplained-fb-promote.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"444\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Bo Andersen\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codingexplained\" \/>\n<meta name=\"twitter:site\" content=\"@codingexplained\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bo Andersen\" \/>\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\":\"WebPage\",\"@id\":\"https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file\",\"url\":\"https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file\",\"name\":\"Moving .ebextensions to root in .war file\",\"isPartOf\":{\"@id\":\"https:\/\/codingexplained.com\/#website\"},\"datePublished\":\"2015-03-06T20:35:51+00:00\",\"dateModified\":\"2015-03-06T20:33:53+00:00\",\"author\":{\"@id\":\"https:\/\/codingexplained.com\/#\/schema\/person\/e19c92ec991f571605f047cefeaa950d\"},\"description\":\"Moving a .ebextensions to the root of a .war file for use with Amazon's Elastic Beanstalk is simple. With Maven, this can easily be accomplished.\",\"breadcrumb\":{\"@id\":\"https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codingexplained.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Moving .ebextensions to root in .war file\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codingexplained.com\/#website\",\"url\":\"https:\/\/codingexplained.com\/\",\"name\":\"Coding Explained\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codingexplained.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/codingexplained.com\/#\/schema\/person\/e19c92ec991f571605f047cefeaa950d\",\"name\":\"Bo Andersen\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codingexplained.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/28f5826f9d5d544b0c5e1ec321dfdfb8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/28f5826f9d5d544b0c5e1ec321dfdfb8?s=96&d=mm&r=g\",\"caption\":\"Bo Andersen\"},\"description\":\"I am a back-end web developer with a passion for open source technologies. I have been a PHP developer for many years, and also have experience with Java and Spring Framework. I currently work full time as a lead developer. Apart from that, I also spend time on making online courses, so be sure to check those out!\",\"sameAs\":[\"https:\/\/codingexplained.com\",\"https:\/\/www.facebook.com\/codingexplained\",\"https:\/\/www.linkedin.com\/in\/ba0708\",\"https:\/\/twitter.com\/codingexplained\",\"https:\/\/www.youtube.com\/c\/codingexplained\"],\"url\":\"https:\/\/codingexplained.com\/author\/andy\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Moving .ebextensions to root in .war file","description":"Moving a .ebextensions to the root of a .war file for use with Amazon's Elastic Beanstalk is simple. With Maven, this can easily be accomplished.","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:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file","og_locale":"en_US","og_type":"article","og_title":"Moving .ebextensions to root in .war file","og_description":"Moving a .ebextensions to the root of a .war file for use with Amazon's Elastic Beanstalk is simple. With Maven, this can easily be accomplished.","og_url":"https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file","og_site_name":"Coding Explained","article_publisher":"https:\/\/www.facebook.com\/codingexplained","article_author":"https:\/\/www.facebook.com\/codingexplained","article_published_time":"2015-03-06T20:35:51+00:00","article_modified_time":"2015-03-06T20:33:53+00:00","og_image":[{"width":1200,"height":444,"url":"https:\/\/codingexplained.com\/wp-content\/uploads\/2015\/11\/codingexplained-fb-promote.png","type":"image\/png"}],"author":"Bo Andersen","twitter_card":"summary_large_image","twitter_creator":"@codingexplained","twitter_site":"@codingexplained","twitter_misc":{"Written by":"Bo Andersen","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file","url":"https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file","name":"Moving .ebextensions to root in .war file","isPartOf":{"@id":"https:\/\/codingexplained.com\/#website"},"datePublished":"2015-03-06T20:35:51+00:00","dateModified":"2015-03-06T20:33:53+00:00","author":{"@id":"https:\/\/codingexplained.com\/#\/schema\/person\/e19c92ec991f571605f047cefeaa950d"},"description":"Moving a .ebextensions to the root of a .war file for use with Amazon's Elastic Beanstalk is simple. With Maven, this can easily be accomplished.","breadcrumb":{"@id":"https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/codingexplained.com\/coding\/java\/moving-ebextensions-root-war-file#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codingexplained.com\/"},{"@type":"ListItem","position":2,"name":"Moving .ebextensions to root in .war file"}]},{"@type":"WebSite","@id":"https:\/\/codingexplained.com\/#website","url":"https:\/\/codingexplained.com\/","name":"Coding Explained","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codingexplained.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/codingexplained.com\/#\/schema\/person\/e19c92ec991f571605f047cefeaa950d","name":"Bo Andersen","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codingexplained.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/28f5826f9d5d544b0c5e1ec321dfdfb8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/28f5826f9d5d544b0c5e1ec321dfdfb8?s=96&d=mm&r=g","caption":"Bo Andersen"},"description":"I am a back-end web developer with a passion for open source technologies. I have been a PHP developer for many years, and also have experience with Java and Spring Framework. I currently work full time as a lead developer. Apart from that, I also spend time on making online courses, so be sure to check those out!","sameAs":["https:\/\/codingexplained.com","https:\/\/www.facebook.com\/codingexplained","https:\/\/www.linkedin.com\/in\/ba0708","https:\/\/twitter.com\/codingexplained","https:\/\/www.youtube.com\/c\/codingexplained"],"url":"https:\/\/codingexplained.com\/author\/andy"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3mJkW-p7","_links":{"self":[{"href":"https:\/\/codingexplained.com\/wp-json\/wp\/v2\/posts\/1557"}],"collection":[{"href":"https:\/\/codingexplained.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codingexplained.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codingexplained.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codingexplained.com\/wp-json\/wp\/v2\/comments?post=1557"}],"version-history":[{"count":4,"href":"https:\/\/codingexplained.com\/wp-json\/wp\/v2\/posts\/1557\/revisions"}],"predecessor-version":[{"id":1575,"href":"https:\/\/codingexplained.com\/wp-json\/wp\/v2\/posts\/1557\/revisions\/1575"}],"wp:attachment":[{"href":"https:\/\/codingexplained.com\/wp-json\/wp\/v2\/media?parent=1557"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codingexplained.com\/wp-json\/wp\/v2\/categories?post=1557"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codingexplained.com\/wp-json\/wp\/v2\/tags?post=1557"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/codingexplained.com\/wp-json\/wp\/v2\/series?post=1557"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}