Reputation: 243
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
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>
Upvotes: 8
Views: 16449
Reputation: 1
Here you have used assembly plugin with jar-with-dependencies . This will create a zip file say xyz-jar-with-dependencies.zip.
The error clearly states that you cannot include any *.zip inside xyz-jar-with-dependencies.zip.
So if you <excludes> <exclude>**/*.zip</exclude> </excludes>
form you assembly configuration or from assembly descriptor if you are using, this error can be fixed.
Upvotes: 0
Reputation: 584
in my case I had an empty includes tag.
<assembly>
<id>assembly</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<outputDirectory>lib</outputDirectory>
<includes>
</includes>
</fileSet>
</fileSets>
</assembly>
Upvotes: 0
Reputation: 243
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>
Upvotes: 6
Reputation: 4934
try adding Excludes in your configuration:
<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>
<excludes>
<exclude>**/*.zip</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
Upvotes: 4