java – Download WAR from snapshot-repository and deploy to local JBoss using mvn – Stack Overflow

Ideally you would want to set up Jenkins to deploy to your testing server as part of your CI build.

Alternatively, if you want to manually run a script on the server you are deploying to, you could set up a specific pom.xml to perform this task. First setup the dependency plugin to download your war:

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-dependency-plugin</artifactId>

<version>2.3</version>

<executions>

<execution>

<phase>package</phase>

<goals>

<goal>copy</goal>

</goals>

<configuration>

<artifactItems>

<artifactItem>

<groupId>my-group</groupId>

<artifactId>my-web-archive</artifactId>

<version>my-vesion</version>

<type>war</type>

<destFileName>my-web-archive.war</destFileName>

</artifactItem>

</artifactItems>

<outputDirectory>${project.build.directory}</outputDirectory>

</configuration>

</execution>

</executions>

</plugin>

Substituting the group ID, artifact ID and version for the respective properties of your WAR file. Next configure the JBoss plugin to deploy the downloaded WAR:

<plugin>

<groupId>org.codehaus.mojo</groupId>

<artifactId>jboss-maven-plugin</artifactId>

<version>1.5.0</version>

<configuration>

<jbossHome>/opt/jboss-6</jbossHome>

<serverName>all</serverName>

<fileName>${project.build.directory}/my-web-archive.war</fileName>

</configuration>

</plugin>

You should then be able to download the artifact from your internal repository and deploy it in the locally running JBoss container with the following command:

mvn package jboss:hard-deploy

via java – Download WAR from snapshot-repository and deploy to local JBoss using mvn – Stack Overflow.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.