2013-02-11 61 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

相关问题