2013-02-11 59 views
1

我有一個多模塊項目,我使用程序集插件將它組裝到一個胖罐子中。謝謝到目前爲止工作得很好,但現在我想要構建另一個jar,只包含uber-pom的依賴關係的特殊包。在多模塊項目上構建一個「光」罐子

一個例子:

我對子項目3個DEPS,我想有

  • com.mycompany.api一個罐子*,
  • com.mycompany.settings。 *
  • com.mycompany.public。*

但不

  • com.mycompany.internal。*

這些包是通過3個DEPS分佈。

有沒有機會使用程序集插件來實現類似的功能?

感謝, 揚

回答

3

Shade插件應該大概能夠做這樣的事情。

<build> 
    <plugins> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-shade-plugin</artifactId> 
     <version>2.0</version> 
     <executions> 
      <execution> 
      <phase>package</phase> 
      <goals> 
       <goal>shade</goal> 
      </goals> 
      <configuration> 
       <filters> 
       <filter> 
        <artifact>*:*</artifact> 
        <includes> 
        <include>com/mycompany/api/*</include> 
        <include>com/mycompany/settings/*</include> 
        <include>com/mycompany/public/*</include> 
        </includes> 
       </filter> 
       </filters> 
      </configuration> 
      </execution> 
     </executions> 
     </plugin> 
    </plugins> 
    </build> 
+0

+1:看起來不錯! – carlspring 2013-02-11 16:18:39

+0

@gustafc謝謝你,這是有效的。但現在我有另一個問題。在我最初的「agregator」項目中,我使用模塊來構建所有模塊,並從目標文件夾中獲取結果(jar,sources-jar,jar-with-dependecies)。此外,我從jenkins上構建的子模塊(使用.net編譯器)抓取了一些dll,並且需要使用我的配置zip。 在我的朋友,我開始了一個模塊構建,然後使用程序集插件(和'moduleSets'section)。對於我需要使用pom包裝的模塊,但陰影插件現在也可以生成pom(不是罐子),儘管這是一個罐子。任何提示? – 2013-02-12 14:56:18

+0

我並不完全確定自己明白(或者如果我這樣做,我將能夠提供幫助)。您可能希望將其作爲單獨的問題發佈。 – gustafc 2013-02-12 15:06:23

相關問題