Where to add .ebextensions in a WAR?

后端 未结 5 1700
天命终不由人
天命终不由人 2020-12-05 23:28

Scenario:

  • AWS Elastic Beanstalk
  • Java application
  • .ebextensions currently placed in src/main/resources/.ebextensions

Commands a

相关标签:
5条回答
  • 2020-12-05 23:51

    Update for people here in 2020, now task name is "bootWar"

    bootWar {
        from('src/main/resources/ebextensions') {
            into('.ebextensions')
        }
    }
    
    0 讨论(0)
  • 2020-12-05 23:53

    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.

    0 讨论(0)
  • 2020-12-05 23:53

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

    war {
        from('src/main/resources/ebextensions') {
            into('.ebextensions')
        }
    }
    
    0 讨论(0)
  • 2020-12-05 23:58

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

    0 讨论(0)
  • 2020-12-06 00:09

    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.

    0 讨论(0)
提交回复
热议问题