首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用jenkins创建war文件

无法使用jenkins创建war文件
EN

Stack Overflow用户
提问于 2017-05-22 13:58:21
回答 1查看 1.1K关注 0票数 0

我无法使用jenkins创建我的maven项目的war文件。有没有人可以帮助我描述使用jenkins创建war文件所需的正确步骤。我使用的是tomcat7、apache-maven-3.3.9和jenkins。我还在jenkins中安装了部署插件。E:\software\tomcat-7\tomcat7\conf\tomcat-user

代码语言:javascript
复制
E:\software\tomcat-7\tomcat7\webapps\apache-maven-3.3.9\conf\settings.xml

<server>
  <id>TomcatServer</id>
  <username>admin</username>
  <password>password</password>
</server>

pom.xml--

代码语言:javascript
复制
<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.java.ex</groupId>
<artifactId>springtest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>springtest</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>3.8.1</version>
  <scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.0.9.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.0.9.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc --
>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.0.9.RELEASE</version>
 </dependency>

  </dependencies>
  <build>
   <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
      <failOnMissingWebXml>false</failOnMissingWebXml>
    </configuration>
    </plugin>
  </plugins>
  </build>
 </project>

请告诉我解决方案...我是jenkins的新手...

EN

回答 1

Stack Overflow用户

发布于 2017-05-24 17:51:09

代码语言:javascript
复制
I added the following code in pom.xml and it worked....

<plugins>
 <plugin>
   <artifactId>maven-deploy-plugin</artifactId>
     <version>2.8.2</version>
       <executions>
                 <execution>
                    <id>default-deploy</id>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                </execution>
                <execution>
                    <id>deploy-node-modules-artifact</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>deploy-file</goal>
                    </goals>

                </execution>
            </executions>
        </plugin>
           <plugin>
              <artifactId>maven-antrun-plugin</artifactId>
                 <executions>
             <execution>
               <id>copy_package</id>
                  <phase>install</phase>
             <goals>
   <goal>run</goal>
   </goals>
   <configuration>
   <tasks>
   <copy file="target/springtest.war"
         todir="E:/software/tomcat-7/tomcat7/webapps"/></tasks>
 </configuration>
         </execution>
   </executions>
   </plugin>

</plugins>

  </build>
  <distributionManagement>
   <repository>
    <id>central</id>
    <name>plugins-releases</name>
    <url>http://serverip:8081/artifactory/plugins-release-local</url>
   </repository>
    <snapshotRepository>
    <id>snapshots</id>
    <name>plugins-snapshot</name>
    <url>http://serverip:8081/artifactory/plugins-snapshot-local</url>
    </snapshotRepository>
      </distributionManagement>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44105572

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档