我有一个 Maven 项目,其中包含三个文件,如下所示:src/main/webapp/file.xmlsrc/main/webapp/fileA.xmlsrc/main/webapp/fileB.xml我的目标是使用相同的 jenkins 任务归档三个不同的 war 包,其中每个资源文件都被重命名并称为file.xml.结果应该是:package-with-file.warpackage-with-fileA.warpackage-with-fileB.war第一个包应该删除fileA.xml和fileB.xml第二应该删除file.xml,并fileB.xml和重命名fileA.xml的file.xml第三应该删除file.xml和fileA.xml,并重新命名fileB.xml的file.xml我的事情的方式,可以使用profiles和使用maven-deploy-plugin定义不同classifier,并filename为每个包,但我不知道如何之前重命名文件。<plugin> <artifactId>maven-deploy-plugin</artifactId> [...] <configuration> <groupId>${project.groupId}</groupId> <artifactId>${project.artifactId}</artifactId> <packaging>war</packaging> <version>${project.version}</version> <classifier>fileA</classifier> <file> ${project.build.directory}/${project.build.finalName}-fileA.war </file> </configuration> [...]</plugin>
2 回答
![?](http://img1.sycdn.imooc.com/5458643d0001a93c02200220-100-100.jpg)
UYOU
TA贡献1878条经验 获得超4个赞
我会将文件放在 3 个不同的目录中:src/main/webapp-A|B|C/file.xml 然后编写 3 个不同的 maven-war-plugin 执行,每个都添加这些目录之一,如下所示:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp-A</directory>
<targetPath>/</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
-- 编辑 1 --
我认为从一个目录中是不可能的。您必须使用不同的目录或为文件使用不同的名称。
添加回答
举报
0/150
提交
取消