2014-01-23 22 views
1

我已经使用Assembly插件将来自两个工件/罐子的源合并为单独的单个罐子。但是,查看META-INF/maven的新jar文件的内容,有一个maven目录,其中包含来自这两个jar的包。为什么Maven在两个罐子合并时在jar中生成一个maven目录?

enter image description here

几个问题:

1 - 那是什么META-INF/maven目录的目的是什么?
2 - 如何/谁生成该文件,为什么?
3 - 是否有选项将其从存档中删除?
4 - 如果我们将其从档案中删除,会产生什么影响?

这里是我的插件:

<plugin> 
    <artifactId>maven-assembly-plugin</artifactId> 
    <executions> 
     <execution> 
     <id>merge-two-jars</id> 
     <phase>prepare-package</phase> 
     <goals> 
      <goal>single</goal> 
     </goals> 
     <configuration> 
      <finalName>com.ibm.scope.ext.system.agent-${scope.release}-${ibm.build.number}</finalName> 
      <appendAssemblyId>false</appendAssemblyId> 
     <descriptors> 
       <descriptor>src/main/assembly/ppk-agent-merge-agent-common.xml</descriptor> 
      </descriptors> 
      <archive> 
       <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile> 
       <addMavenDescriptor>false</addMavenDescriptor> 
      </archive> 
     </configuration> 
     </execution> 
    </executions> 

.....

+0

请附上您的'PPK代理合并代理-common.xml' – MariuszS

回答

3
  1. 信息化的目的 - 行家功能
  2. 的Maven用于信息目的
  3. 对于JAR,EAR,并WAR插件。使用<archive><addMavenDescriptor>false</addMavenDescriptor></archive>排除META-INF/mavenMWAR-27
  4. 没有影响

重写清单

<project> 
    [...] 
    <build> 
    [...] 
    <plugins> 
     <plugin> 
     <artifactId>maven-assembly-plugin</artifactId> 
     <version>2.4</version> 
     <configuration> 
      [...] 
      <archive> 
      <addMavenDescriptor>false</addMavenDescriptor> 
      </archive> 
     </configuration> 
     [...] 
     </plugin> 
     [...] 
</project> 

更多关于Maven的清单:Maven Archiver

+0

感谢您的反馈,如问题中所述描述中,我使用Assembly插件来生成jar;不是maven.jar.plugin ....任何想法我们如何在程序集中做到这一点? –

+0

重写汇编插件中的'archive'配置,回答更新,试试这个,应该可以工作 – MariuszS

+0

更新'addMavenDescriptor' - 为false,也许这也是需要从合并的jar中排除清单 – MariuszS

相关问题