Where to add .ebextensions in a WAR?

安稳与你 提交于 2019-11-26 23:12:42

问题


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?


回答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.




回答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.




回答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.




回答4:


you missed resources, it works when I put the path right

war {
    from('src/main/resources/ebextensions') {
        into('.ebextensions')
    }
}


来源:https://stackoverflow.com/questions/18423932/where-to-add-ebextensions-in-a-war

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!