0

Is there a way to automatically copy a WAR to a specified location after compiling it?

I use the NetBeans IDE together with Maven for my Java EE programming and was wondering whether there was a way within Maven to do that. I use Ubuntu 15.04 as OS. The way I currently get the WAR to the Application Server is typing a copy command after compiling:

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
Socrates
  • 8,724
  • 25
  • 66
  • 113

1 Answers1

1

This has been working for me (Thank you @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>
Socrates
  • 8,724
  • 25
  • 66
  • 113