压缩文件不能包含自身-Maven-assembly插件 [英] A zip file cannot include itself - Maven-assembly plugin

查看:109
本文介绍了压缩文件不能包含自身-Maven-assembly插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用maven程序集插件构建项目.但是该过程失败,并显示以下错误(我在jenkins中粘贴了该错误.我也检查了是否没有jenkins.)

I'm building a project using maven assembly plugin. But the process fail with the following error,(Here I pasted the error in jenkins. I checked without jenkins too.)

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:29.792s
[INFO] Finished at: Fri Mar 14 10:26:58 IST 2014
[INFO] Final Memory: 26M/75M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:assembly (default) on project ExecutionBot: Failed to create assembly: Error creating     assembly archive jar-with-dependencies: A zip file cannot include itself -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

pom.xml中的配置

Configuration in pom.xml

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <executions>
  <execution>
     <goals>
       <goal>assembly</goal>
     </goals>
     <phase>package</phase>
     <configuration>
       <descriptorRefs>
         <descriptorRef>jar-with-dependencies</descriptorRef>
      </descriptorRefs>
      <archive>
        <manifest>
          <mainClass>com.starter.MyListner</mainClass>
        </manifest>
      </archive>
     </configuration>
     </execution>
    </executions>
</plugin>

推荐答案

在我的情况下,问题使用的是maven程序集插件的版本.默认情况下,它使用版本2.2,并且存在一些问题(直到今天,他们可能会在将来对其进行修复).更好地使用2.1.所以自定义我的代码,如下所示.现在可以正常使用

In my case the prob was with the version of the maven assembly plugin. By default it uses the version 2.2 and it has some issues (up to-today may be they'll fix it in future). Better use 2.1. So customized my code as below. Now its working fine

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.1</version>
    <executions>
         <execution>
         <goals>
            <goal>assembly</goal>
         </goals>
         <phase>package</phase>
         <configuration>
         <descriptorRefs>
             <descriptorRef>jar-with-dependencies</descriptorRef>
         </descriptorRefs>
         <archive>
        <manifest>
          <mainClass>com.starter.MyListner</mainClass>
        </manifest>
       </archive>
      </configuration>
   </execution>
   </executions>
</plugin> 

这篇关于压缩文件不能包含自身-Maven-assembly插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆