Download WAR from snapshot-repository and deploy to local JBoss using mvn

后端 未结 1 1622
[愿得一人]
[愿得一人] 2020-12-17 03:20

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.

相关标签:
1条回答
  • 2020-12-17 03:47

    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
    
    0 讨论(0)
提交回复
热议问题