且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

压缩文件不能包含自身-Maven-assembly插件

更新时间:2023-09-30 11:15:04

在我的情况下,问题使用的是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>