我遇到了一些我需要配置的功能的问题。
这是我的 POM 的一部分,我在其中将项目配置为组装成两个不同的文件:FirstNameProject-VERSION-bin.zip 和 SecondNameProject-VERSION-bin.zip。这个想法是我必须保持这些名称的设置,即使原始的人工制品很常见。
<?xml version="1.0" encoding="UTF-8"?>
http://maven.apache.org/xsd/maven-4.0.0.xsd">4.0.0
<groupId>com.project.my</groupId>
<artifactId>MyGenericProject</artifactId>
<name>Generic Project</name>
<version>2.0.2-SNAPSHOT</version>
...
<build>
<plugins>
....
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>first</id>
<configuration>
<finalName>FirstNameProject-${project.version}-bin</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/resources_first.xml</descriptor>
</descriptors>
</configuration>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
<execution>
<id>second</id>
<configuration>
<finalName>FirstNameProject-${project.version}-bin</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/resources_second.xml</descriptor>
</descriptors>
</configuration>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
这工作正常,在mvn package
日志中我可以看到:
[INFO] --- maven-assembly-plugin:2.2.1:single (first) @ MyGenericProject ---
[INFO] Reading assembly descriptor: src/main/assembly/resources_first.xml
[INFO] Building zip: C:\MyPath\MyProject_trunk\target\FirstNameProject-2 .0.2-bin.zip
[INFO]
[INFO] --- maven-assembly-plugin:2.2.1:single (second) @ MyGenericProject ---
[INFO] Reading assembly descriptor: src/main/assembly/resources_second.xml
[INFO] Building zip: C:\MyPath\MyProject_trunk\target\SecondNameProject-2.0 .2-bin.zip
问题是,在安装期间,它只是恢复为通用名称并将正确命名的文件安装为通用文件!
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @MyGenericProject --- [INFO] 安装 C:\MyPath\MyProject_trunk\target\MyGenericProject-2.0.2-SNAPSHOT.jar 到C:.m2\repository\com\project\my\MyGenericProject\2.0.2-SNAPSHOT\MyGenericProject-2.0.2-SNAPSHOT.jar [INFO] 安装 C:\MyPath\MyProject_trunk\pom.xml 到 C:.m2\ repository\com\project\my\MyGenericProject\2.0.2-SNAPSHOT\MyGenericProject-2.0.2-SNAPSHOT.pom [INFO] 安装 C:\MyPath\MyProject_trunk\target\FirstNameProject-2.0.2-SNAPSHOT-bin.zip 到C:.m2\repository\com\project\my\MyGenericProject\2.0.2-SNAPSHOT\MyGenericProject-2.0.2-SNAPSHOT.zip
我想这是因为安装插件无法准确了解程序集插件的配置方式,所以我问你:如何配置安装插件,以便最终得到FirstNameProject-VERSION-bin.zip和SecondNameProject- VERSION-bin.zip安装在我的存储库中??
我希望我足够清楚,谢谢