从快照存储库下载WAR并使用mvn部署到本地JBoss [英] Download WAR from snapshot-repository and deploy to local JBoss using mvn

查看:152
本文介绍了从快照存储库下载WAR并使用mvn部署到本地JBoss的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我向我的JBoss 6 AS部署了我的 war jboss:hard-deploy 这个工作很好,但是我必须从SVN中检出项目并打包它。



war 已经上传到我们的Jenkins内部快照存储库,如果我可以从这个存储库下载到测试服务器上并直接使用maven将其部署到JBoss,那将是很好的。



这个问题是与从存储库到远程服务器的Maven部署工件战争有关,但我不认为答案是正确的(见该评论)

解决方案

理想情况下,您需要设置Jenkins作为CI构建的一部分部署到测试服务器。 >

或者,如果要在要部署的服务器上手动运行脚本,可以设置一个特定的 pom.xml 执行此任务。首先设置依赖插件来下载你的战争:

 < plugin> 
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-dependency-plugin< / artifactId>
< version> 2.3< / version>
<执行>
< 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 


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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆