2011-12-13 33 views
1

我有一个父母下有四个子POM。其中一个孩子是建立一个包含其他3个模块罐子的拉链。这可以工作,但它不会提取它们各自的依赖关系。Maven Assembly Plugin - 在程序集中包含其他子依赖关系

模块建造的pom.xml:

...  
    <plugin> 
     <artifactId>maven-assembly-plugin</artifactId>    
     <inherited>true</inherited>    
     <configuration> 
      <descriptors> 
      <descriptor>desc.xml</descriptor> 
      </descriptors> 
     </configuration> 
    </plugin> 
... 

desc.xml:不创建

... 

     <moduleSets> 
      <moduleSet> 
       <binaries> 
        <unpack>false</unpack> 
        <dependencySets> 
         <dependencySet> 
          <unpack>false</unpack> 
          <scope>runtime</scope>     
          <outputDirectory>lib</outputDirectory> 
         </dependencySet> 
        </dependencySets> 
       </binaries> 
      </moduleSet> 
     </moduleSets> 
    ... 

所得 'LIB' 文件夹。

任何帮助,将不胜感激。

+0

嗨太阳风,请在评论答案(如果您需要更多帮助)或将其标记为正确。目前这个问题仍然在“未答复”列表中,但由于已经有两个没有评论的答案,我猜你现在不会再有任何问题了。 – Jan 2013-04-30 08:31:34

回答

1

您是否已经将其他3个模块指定为此第4个模块的依赖项,旁边是父级的模块部分?

如果你这样做,就应该工作,即使你这样做:

<assembly> 
<id>final</id> 
    <formats> 
    <format>jar</format> 
    </formats> 
    <includeBaseDirectory>false</includeBaseDirectory> 
    <dependencySets> 
    <dependencySet> 
     <unpack>false</unpack> 
     <scope>runtime</scope>     
     <outputDirectory>lib</outputDirectory> 
    </dependencySet> 
    </dependencySets> 
</assembly> 
1

也许这是一个有点晚,但不管:)。 你应该在父项目中移动你的程序集,但这不是真正的问题。

使用插件的版本:

这里矿山,至极完全功能(但在法国,原谅我;))

<?xml version="1.0" encoding="UTF-8"?> 
<assembly 
    xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> 
    <!-- Ce chemin est lié au plugin maven-jar et à la génération du manifest 
     : à manipuler avec précautions --> 
    <id>lib</id> 
    <formats> 
     <format>zip</format> 
    </formats> 
    <!-- Supprimer la création d'un répertoire dans l'archive au nom du projet --> 
    <includeBaseDirectory>false</includeBaseDirectory> 
    <dependencySets> 
     <dependencySet> 
      <outputDirectory>/</outputDirectory> 
      <unpack>false</unpack> 
      <scope>runtime</scope> 
     </dependencySet> 
    </dependencySets> 
</assembly> 

这是一个内置的插件功能(获取依赖关系)。但我从来没有使用它从一个多模块项目,我知道有一些棘手的考虑与使用OB ModuleSet ...

希望这将有助于...

相关问题