目前我将war
jboss:hard-deploy
部署到我的JBoss 6 AS。这很好,但是我必须从SVN签出项目并打包它。
Jenkins已将war
上传到我们的内部快照存储库,如果我可以从测试服务器上下载它并使用maven直接将其部署到JBoss,那将会很不错。
这个问题与Maven deploy artifact war from repository to remote server有关,但我不认为答案是正确的(请参阅那里的评论)。
答案 0 :(得分:7)
理想情况下,您需要将Jenkins设置为部署到测试服务器,作为CI构建的一部分。
或者,如果要在要部署的服务器上手动运行脚本,可以设置特定的pom.xml
来执行此任务。首先设置依赖插件来下载你的战争:
<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>
替换WAR文件的各个属性的组ID,工件ID和版本。接下来配置JBoss插件以部署下载的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>
然后,您应该能够从内部存储库下载工件,并使用以下命令将其部署在本地运行的JBoss容器中:
mvn package jboss:hard-deploy