Where to add .ebextensions in a WAR?
Solution 1
.ebextensions should be placed in the root of WAR.
The WAR structure looks like the following:
web_app.war
|
|_.ebextensions
| |_ 01run.config
| |_ 02do.config
|
|_META-INF
|
|_WEB-INF
|_ classes
|_ lib
|_ web.xml
Refer to the official AWS docs for further information.
Solution 2
Using Maven I did as follows:
- mkdir src/main/ebextensions
- put .config files into this folder
-
add the following to pom.xml
<plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <webResources> <resource> <directory>src/main/ebextensions</directory> <targetPath>.ebextensions</targetPath> <filtering>true</filtering> </resource> </webResources> </configuration> </plugin>
to transfer the files to the top level of the war when it is built.
Solution 3
Using gradle I did the following
- mkdir src/main/resources/ebextensions
- put .config files into this folder
- add the following to build.gradle
apply plugin: 'war'
war {
from('src/main/resources/ebextensions') {
into('.ebextensions')
}
}
to transfer the files to the top level of the war when it is built.
Solution 4
you missed resources, it works when I put the path right
war {
from('src/main/resources/ebextensions') {
into('.ebextensions')
}
}
Solution 5
Update for people here in 2020, now task name is "bootWar"
bootWar {
from('src/main/resources/ebextensions') {
into('.ebextensions')
}
}
Related videos on Youtube
flavian
A product builder, I pretend to be an engineer from time to time, OSS work. Datastax MVP for Apache Cassandra. Reactive type-safe Scala driver for Cassandra https://github.com/outworkers/phantom Reactive type-safe Scala driver for Neo4J https://github.com/outworkers/reactiveneo
Updated on August 11, 2022Comments
-
flavian over 1 year
Scenario:
- AWS Elastic Beanstalk
- Java application
- .ebextensions currently placed in src/main/resources/.ebextensions
Commands are not being executed.
Where is the .ebextensions supposed to go in a Java application?
-
Paul Taylor almost 10 yearsMy war is built using maven how would i modify my pom to achieve this
-
Gustavo Matias over 9 yearsthat's in src/main/webapp
-
study over 9 years@GustavoMatias, AWS changed the path of
.ebextensions
for a while, but it accepts both paths(in/WEB-INF/.ebextensions
and/.ebextensions
of WAR). -
babalu over 9 years@GustavoMatias no longer works in sbt version 0.13.6, now using jar uf target/scala-2.10/xxx-0.1.0-SNAPSHOT.war src/main/webapp/.ebextensions to insert the dir into the WAR file after packaging.
-
fivedogit over 7 yearsAs of 2017 this method does not appear to work. The plugin XML does, indeed, add the .ebextensions folder to the top level of the war, but when deployed to a beanstalk, that folder and its contents are nowhere to be found.
-
christopher over 7 yearsThis answer seems to place the .ebextensions folder in the root of the classes folder inside the generated JAR, not in the root of it.
-
ATOzTOA over 4 years@fivedogit Did you look in the war file? When deployed to EBS, the folder is used up.