repository and deploy to local JBoss using mvn
currently I deploy my war
with jboss:hard-deploy
to my JBoss 6 AS. This works fine, but I have to checkout project from SVN and package it.
The war
is already uploaded to our internal snapshot repository by Jenkins and it would be nice if I can download it on a testing server from this repository and directly deploy it to JBoss using maven.
This question is related to Maven deploy artifact war from repository to remote server, but I don't think the answer is correct (see the comment there).
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
链接地址: http://www.djcxy.com/p/29670.html
上一篇: 使用Maven复制文件的最佳做法
下一篇: 存储库并使用mvn部署到本地JBoss