我正在使用maven-assembly插件创建 zip,如何在使用相同插件进行压缩时重命名一些文件?
更新:
这是 pom 中的配置文件
<profile>
<id>D1</id>
<activation>
<property>
<name>D1</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>assembly/online-distribution.D1.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
这是 Assembly.xml
<?xml version="1.0" encoding="UTF-8" ?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-
plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<formats>
<format>tar.gz</format>
</formats>
<id>online</id>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySet>
<outputDirectory>resources</outputDirectory>
<unpack>true</unpack>
<includes>
<include>${project.groupId}:core-config:jar</include>
</includes>
<unpackOptions>
<includes>
<include>coresrv/env-config.D1.properties</include>
</includes>
</unpackOptions>
</dependencySet>
<files>
<file>
<source>${project.groupId}/core-config.jar/coresrv/env-config.D1.properties</source>
<outputDirectory>/</outputDirectory>
<destName>env-config.properties</destName>
</file>
</files>
</assembly>
我得到那个罐子并解压它,然后重命名一个文件并再次压缩它。谢谢