我的項目使用了很多程序集,因此我只對程序集感興趣。 在執行mvn install與assembly之外,我得到默認的打包.jar。 我該如何避免這種情況?Maven-2:避免默認打包?
我有一個類似於你所提供的pom.xml。 上執行MVN安裝,我越來越App1.jar,App2.jar,以及包含快照JAR中的所有內容
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-2</version>
<executions>
<execution>
<id>assemblyone</id>
<phase>compile</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>App1</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>${basedir}/src/main/resources/assemblies/report.xml</descriptor>
</descriptors>
</configuration>
</execution>
<execution>
<id>assemblytwo</id>
<phase>compile</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>App2</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>${basedir}/src/main/resources/assemblies/src.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
我怎樣才能避免這種快照(不知道確切的術語)的容器,並確保只有組件創建?
嗨 感謝您的inputs.i不認爲我能夠創建單獨的模塊說App1,App2..bcoz我的程序集罐子,即App1.jar,App2.jar有共同的文件被包括在內。 如果我將packagins指定爲'pom',MyApp-1.0.0 jar將不會被創建? – user170114 2009-09-16 11:22:10
那麼,那些常見的文件將被放置在第三個位置,或者在它們自己的組件中被解壓到每個模塊中,或者被放在父模塊中並且被每個孩子引用(不那麼幹淨)。標記你的父模塊一個「POM」不會創建JAR,但是,你仍然會違反Maven的原則而沒有按照我的建議去做。搜索「Maven:權威指南」 - 一本關於Maven的免費書籍。 – SingleShot 2009-09-16 16:30:22
謝謝..我想我需要去選擇將這些常用軟件包放入父母並從孩子訪問。 在這種情況下,我應該在哪裏保留我的程序集描述符?在父/子程序集下?如何指向父文件夾..我不能使用-project.build.outputDirectory對嗎? – user170114 2009-09-17 05:51:02