文章目录
原因
碰到这样一个情况,在jekins上面配置的路径,跟打包的路径隔了一个目录,然后改jekins上面目录极其复杂要申请,所以,就只能自己修改生成war包的位置了,我们项目当时在一个大项目里面,举个栗子:
这是项目大概结构:
test-base
=====target
=====test-api
========target
=====test-war
========target
=====test-core
========target
然后jekins配置的是在test-base下的target里面的war包,但是生成生在了test-war包下面,所以我打包需要将test-war下target包拷贝到test-base下的target包里面.
解决
outputDirectory可以写绝对路径,可以写相对路径;
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>copy-war</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<type>${project.packaging}</type>
<destFileName>test.war</destFileName>
</artifactItem>
</artifactItems>
<outputDirectory>../target</outputDirectory>
<includes>
<include>*.war</include>
</includes>
<stripVersion>true</stripVersion>
</configuration>
</execution>
</executions>
</plugin>