从快照存储库下载 WAR 并使用 mvn 部署到本地 JBoss [英] Download WAR from snapshot-repository and deploy to local JBoss using mvn
问题描述
目前我使用 jboss:hard-deploy
将我的 war
部署到我的 JBoss 6 AS.这工作正常,但我必须从 SVN 签出项目并将其打包.
war
已经由 Jenkins 上传到我们的内部快照存储库,如果我可以从该存储库将其下载到测试服务器上并使用 maven 直接将其部署到 JBoss,那就太好了.>
这个问题与Maven将工件战争从存储库部署到远程服务器有关,但我认为答案不正确(请参阅那里的评论).
理想情况下,您希望设置 Jenkins 作为 CI 构建的一部分部署到您的测试服务器.
或者,如果您想在要部署到的服务器上手动运行脚本,您可以设置一个特定的 pom.xml
来执行此任务.首先设置依赖插件来下载你的战争:
<插件><groupId>org.apache.maven.plugins</groupId><artifactId>maven-dependency-plugin</artifactId><version>2.3</version><执行><执行><phase>包</phase><目标><目标>复制</目标></目标><配置><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></配置></执行></执行></插件>
用组 ID、工件 ID 和版本替换 WAR 文件的相应属性.接下来配置 JBoss 插件以部署下载的 WAR:
<插件><groupId>org.codehaus.mojo</groupId><artifactId>jboss-maven-plugin</artifactId><version>1.5.0</version><配置><jbossHome>/opt/jboss-6</jbossHome><serverName>all</serverName><fileName>${project.build.directory}/my-web-archive.war</fileName></配置></插件>
然后,您应该能够从内部存储库下载工件,并使用以下命令将其部署到本地运行的 JBoss 容器中:
mvn 包 jboss:hard-deploy
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
这篇关于从快照存储库下载 WAR 并使用 mvn 部署到本地 JBoss的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!