将WAR复制到Application Server

时间:2015-06-27 18:01:01

标签: java maven deployment jar war

有没有办法在编译后自动将WAR复制到指定位置?

我将NetBeans IDE与Maven一起用于我的Java EE编程,并且想知道Maven中是否有办法做到这一点。我使用Ubuntu 15.04作为操作系统。我目前将WAR送到Application Server的方法是在编译后输入一个复制命令:

scp /home/user/.m2/repository/com/myproj/myapp/1.0/myapp-1.0.war user@appserver:/opt/wildfly-8.2.0.Final/standalone/deployments/myapp.war

1 个答案:

答案 0 :(得分:1)

这对我有用(谢谢@facundofarias):

        <plugin>
            <artifactId>exec-maven-plugin</artifactId>
            <groupId>org.codehaus.mojo</groupId>
            <executions>
                <execution><!-- Run our version calculation script -->
                    <id>Copy to Application Server</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                    <configuration>
                        <executable>${basedir}/copy-to-appserver.sh</executable>
                    </configuration>
                </execution>
            </executions>
        </plugin>