Maven 3 – How to deploy a WAR package
When you are using an auto deploy directory of an application server have you ever wondered how much time you waste while switching through windows while building and deploying web application while working on it? You can easily configure maven 3 to deploy WAR application package after it has been created. Just enter following code in your pom.xml file.
[PACKAGE_FILE_NAME] with your WAR package name.
[APPSERVER_AUTO_DEPLOY_DIRECTORY] with a path to your app servers auto deploy directory.
<build> <plugins> <plugin> <artifactId>maven-antrun-plugin</artifactId> <executions> <execution> <id>copy_package</id> <phase>install</phase> <goals> <goal>run</goal> </goals> <configuration> <tasks> <copy file="target/[PACKAGE_FILE_NAME]" todir="[APPSERVER_AUTO_DEPLOY_DIRECTORY]" /> </tasks> </configuration> </execution> </executions> </plugin> </plugins> </build>
This configuration is copying application package file to your application servers auto deploy directory.