Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creates corrupt JARs #58

Closed
towtow opened this issue May 15, 2017 · 8 comments
Closed

Creates corrupt JARs #58

towtow opened this issue May 15, 2017 · 8 comments
Assignees
Labels
Milestone

Comments

@towtow
Copy link

towtow commented May 15, 2017

Creating a maven assembly "jar-with-dependencies" results in a JAR that can't be extracted: java.io.IOException: META-INF/maven/commons-io/commons-io : could not create directory using the maven assembly plugin 3.0.0 which in turn uses plexus-archiver 3.4.

After downgrading the plexus-archiver version to 3.0.1-3.0.3 or 2.10.3 it works.

List of plexus-archiver versions tested:

  • 2.10.3 - OK
  • 3.0 - incompatible (method not found)
  • 3.0.1 - OK
  • 3.0.2 - OK
  • 3.0.3 - BROKEN
  • 3.1.1 - BROKEN
  • 3.2 - BROKEN
  • 3.3 - BROKEN
  • 3.4 - BROKEN
@michael-o
Copy link
Member

Were you able to bisect to the offending change?

@plamentotev
Copy link
Member

plamentotev commented May 15, 2017

Hi,

Thanks for reporting this. Could you please provide steps to reproduce? I've tried to create jar-with-dependencies assembly and it worked.

@towtow
Copy link
Author

towtow commented May 19, 2017

I am able to reproduce this problem 100% of the time by putting this pom in an empty folder:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <archiverVersion>3.4</archiverVersion> <!-- assembly plugin 3.0.0 defaults to nexus-archiver 3.4 -->
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptorRefs>
                                <descriptorRef>jar-with-dependencies</descriptorRef>
                            </descriptorRefs>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.plexus</groupId>
                        <artifactId>plexus-archiver</artifactId>
                        <version>${archiverVersion}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>
</project>

And then running something like:

mvn -DarchiverVersion=3.0.3 clean package && (cd target/ && jar xvf test-1.0-SNAPSHOT-jar-with-dependencies.jar >/dev/null) || echo '>>> ERROR <<<'

results in:

java.io.IOException: META-INF/maven : could not create directory
    at sun.tools.jar.Main.extractFile(Main.java:1007)
    at sun.tools.jar.Main.extract(Main.java:924)
    at sun.tools.jar.Main.run(Main.java:264)
    at sun.tools.jar.Main.main(Main.java:1231)
>>> ERROR <<<

I am using:

  • Ubuntu Linux 16.04
  • Oracle Java JDK 1.7.0_80
  • Maven 3.3.9

@plamentotev
Copy link
Member

plamentotev commented May 20, 2017

Thanks for the detailed information.

It turns out this is caused by a bug in Commons Compress - COMPRESS-379. Updating the dependency to version 1.14 should fix the issue.

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-compress</artifactId>
    <version>1.14</version>
</dependency>

@plamentotev
Copy link
Member

It is interesting why I'm not able to reproduce this issue on Windows. While I'm not completely sure, I believe that COMPRESS-379 is reproducible on Windows. And still looks like test-1.0-SNAPSHOT-jar-with-dependencies.jar is not corrupted.

@michael-o
Copy link
Member

Commons Compress has been upgraded to 1.14, please revalidate this issue.

@plamentotev
Copy link
Member

It should be fixed now. But it would be nice if @towtow could confirm that too.

@towtow
Copy link
Author

towtow commented Jun 12, 2017

I can confirm that it works for me as well.
I ran mvn install on the current master and mvn -DarchiverVersion=3.5-SNAPSHOT... on my example above. So the issue seems to be fixed, thanks!

@michael-o michael-o self-assigned this Jun 12, 2017
@michael-o michael-o added the bug label Jun 12, 2017
@michael-o michael-o added this to the 3.5 milestone Jun 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants