1
我有4個模塊 我一般POM是這樣的:Maven的:除去jar文件時,罐子的依賴已經建立
<artifactId>A</artifactId>
<name>Modules</name>
<packaging>pom</packaging>
<modules>
<module>B</module>
<module>C</module>
<module>D</module>
<module>E</module>
</modules>
在模塊EI在E的POM我必須有主類,所以:
<parent>
<artifactId>A</artifactId>
</parent>
<artifactId>E</artifactId>
<name>E</name>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>group</groupId>
<artifactId>C</artifactId>
</dependency>
<dependency>
<groupId>group</groupId>
<artifactId>D</artifactId>
</dependency>
<dependency>
<groupId>group</groupId>
<artifactId>B</artifactId>
</dependency>
</dependencies>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>Mainclass</mainClass>
<addClasspath>true</addClasspath>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
當我運行mvn包;它會創建B.jar,C.jar,D.jar和E-jar-with-dependencies.jar。 我只想創建最後一個罐子,因爲B,C和D在E-jar-with-dependencies.jar中
是否有可能?
我需要構建它們,但我只想在E上添加它們。我不再需要b.jar,c.jar和d.jar。 – DaniG 2012-03-01 15:40:32