我试图从同一个项目中创建2个罐子。
使用汇编
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.5</version>
<executions>
<execution>
<id>Mock-1</id>
<configuration>
<finalName>Mock-1</finalName>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>mock.DSlauncher.Launcher</mainClass>
</manifest>
</archive>
</configuration>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
<execution>
<id>Mock-2</id>
<configuration>
<finalName>Mock-2</finalName>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>mock.DSlauncher.Launcher_search</mainClass>
</manifest>
</archive>
</configuration>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
maven输出:
[INFO]
[INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ MockLibirator ---
[INFO] Building jar: .../Project/UAT-Mock/target/MockLibirator-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-assembly-plugin:2.5.5:single (Mock-1) @ MockLibirator ---
[INFO] Building jar: .../Project/UAT-Mock/target/Mock-1-jar-with-dependencies.jar
[INFO]
[INFO] --- maven-assembly-plugin:2.5.5:single (Mock-2) @ MockLibirator ---
[INFO] Building jar: .../Project/UAT-Mock/target/Mock-2-jar-with-dependencies.jar
[WARNING] Artifact CVM-Automation:MockLibirator:jar:jar-with-dependencies:1.0-SNAPSHOT already attached to project, ignoring duplicate
有没有办法不编译默认jar(第一个)并修复警告信息......
谢谢