deploy java maven project to ec2 with pallet?

你说的曾经没有我的故事 提交于 2019-12-05 23:31:03

I can't speak to the AWS and Pallet part of your question, but assuming you have a running tomcat instance you can use the Apache Cargo project directly from maven to deploy your app:

Here is a sanitized version of our cargo configuration:

        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.2.1</version>
            <configuration>
              <container>
                <containerId>tomcat6x</containerId>
                <type>remote</type>
              </container>

              <configuration>
                <type>runtime</type>
                <properties>
                    <cargo.hostname>${tomcat.hostname}</cargo.hostname>   
                    <cargo.servlet.port>8080</cargo.servlet.port>
                    <cargo.remote.username>$[tomcat.username}</cargo.remote.username>
                    <cargo.remote.password>${tomcat.password}</cargo.remote.password>
                </properties>
              </configuration>

              <deployer>
                <type>remote</type>
                <deployables>
                  <deployable>
                    <groupId>com.mycompany</groupId>
                    <artifactId>MyWebApp</artifactId>
                    <type>war</type>
                    <pingURL>http://my.company.com/url</pingURL>
                    <pingTimeout>80000</pingTimeout>
                    <properties>
                        <context>ROOT</context>
                    </properties>
                  </deployable>
                </deployables>
              </deployer>
            </configuration>
        </plugin>

You can then get this run with this command (set the relevant properties of course):

mvn -DskipTests package cargo:deploy

More information on Using Apache Cargo with Maven is here: http://cargo.codehaus.org/Maven2+Plugin+Getting+Started

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