-
Notifications
You must be signed in to change notification settings - Fork 400
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
ShadowJar fails with IllegalArgumentException #294
Comments
The above exception output is from using 2.0.0-SNAPSHOT of the shadow plugin. I got a similar error when using 1.2.4 (similar but not the same because with 1.2.4 it was not using shadowed asm as seen here - shadow.org.objectweb.asm.ClassReader) |
@IceMan81 do you have an example project that exhibits the problem? |
@johnrengelman At present I don't, but I will try to create one. Meanwhile I tested with the released 2.0.0 version. It exhibits the same behavior. |
@johnrengelman I created an sample project to see if could reproduce the issue (outside of the project where I'm seeing this exception) so far I've been unable to reproduce the issue. There is probably some dependency that is causing this that I haven't been able to figure out so far. Could you think of any way I could try to get more information in the exception? Atleast if it was possible to figure out what class was causing this issue. One thing I did observe was that in my real project the issue went away if I did not try to relocate any packages.
|
@johnrengelman Finally, I can reproduce the issue in a stand alone settings. I'm having some issue with my internal proxy so I'm unable to push out the code to github. https://gist.github.com/IceMan81/059e77b48cd7318732d2863a80c021a3 The culprit is this dependency.
|
@johnrengelman Any ideas on what might be the issue here? |
I'm having this exact problem with a library that copies classes from byteman. After digging into it, I've discovered that library has some classes that are compiled with Java 9: I tried adding the offending classes to an exclude, but the error happens regardless. This is a pretty high priority blocker for me as it completely precludes me from using this plugin. It wouldn't be so bad if there was a gentle way of skipping over these classes that will obviously not work. I'd also suggest expanding the try block with the more helpful error message to include the Additionally, it appears the ASM 6 Alpha version that was just published does support Java 9. Perhaps consider upgrading to that? @johnrengelman great plugin btw. Thanks so much for providing it to the community. |
Related to this - https://issues.apache.org/jira/browse/MSHADE-242. This is happening because ASM doesn't support Java 9 compiled classes at the moment. There is an alpha of ASM 6.0 available, but I don't think it's a good idea to upgrade Shadow to use it. |
@johnrengelman will you at least be able to make it handle Java 9 classes gracefully without failing? |
I don't know what that "gracefully" would look like. If I make Shadow just eat that exception, then the resulting Jar file would not be correct (you'd be missing entries). The proper way to handle this would be to exclude any dependencies that built on Java 9 from the merging process - http://imperceptiblethoughts.com/shadow/#filtering_dependencies Remember, dependencies need to be excluded using the |
Ah, I didn't realize I could exclude the individual files that were java 9 compiled and it would skip them without failure. I thought I tried that, but I think I didn't get all of them. I have it working now by excluding them. Thanks. |
I'm currently developing a java agent that uses ASM6. this issue prevents relocating ASM packages so they don't interfere with the application classpath. |
Does anyone have a dependency that I can add to a test that makes this happen? |
Can someone trying the 2.0.2-SNAPSHOT and see if this error goes away? The snapshot repository is at http://oss.jfrog.org/artifactory/simple/oss-snapshot-local/ |
@IceMan81 I added a test case for this and it appears fixed in the 2.0.2-SNAPSHOT release if you can try it out. |
@johnrengelman I was receiving the same error when attempting to relocate packages in a project and verified that the problem was resolved in the 2.0.2-SNAPSHOT build. |
@johnrengelman 2.0.2-SNAPSHOT fixes the issue for me. the relocation works with asm 6.0. |
the snapshot jar doesn't seem to live in the repository given above, can i have the link to the new repository where it is present ? |
@kuttykumard I definitely does exist in that oss repo above: http://oss.jfrog.org/simple/oss-snapshot-local/com/github/jengelman/gradle/plugins/shadow/2.0.2-SNAPSHOT/ |
I've tried |
2.0.2 is now available with this fix. |
Please check the (User Guide)[http://imperceptiblethoughts.com/shadow] before submitting "how do I do 'x'?" questions!
Shadow Version
Tried with
1.2.4
and latest
2.0.0-SNAPSHOT
(which I built locally)
Gradle Version
tried with Gradle 3.1
and 3.5
Expected Behavior
ShadowJar should succeed
Actual Behavior
Throws the following IllegalArgumentException
Gradle Build Script(s)
Content of Shadow JAR (
jar tf <jar file>
- post link to GIST if too long)The text was updated successfully, but these errors were encountered: