-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Maven Build Issue from Setting Class-Path
in the jar manifest for grpc-netty-shaded
#8606
Comments
Can you try by adding
in your pom.xml as described in this document? |
@ejona86 Is the particular Class-Path attribute in grpc-netty-shaded MANIFEST.MF necessary or does it have any value? |
It isn't necessary, but I'm suspicious that michaelli321's using some broken tooling for it to be causing problems. I don't understand how it could cause problems, unless you are doing |
I tried by adding
in the grpc helloworld example https://github.com/grpc/grpc-java/blob/v1.41.0/examples/pom.xml as described in "Steps to reproduce the bug" above, |
@dapengzhang0 sorry I'm not able to provide a complete reproducible project since the project is for my company. I'm able to get around the warnings using references: |
Something doesn't add up, because the Class-Path attribute is only used with FWIW, we didn't explicitly add Class-Path to grpc-netty-shaded. It was added there automatically by a plugin (which was also trying to be helpful). We can try to find how to disable that feature in the plugin, but it isn't all that wrong of the plugin since it should have no effect. |
I see thanks for checking on that!
Based off what I've been reading, I don't think this is true.
but yes I agree something weird is happening because we weren't running into this issue before and it just now surfaced |
As a side note to all this, you really shouldn't have grpc-netty-shaded in the compile scope. We'd expect it to be runtime scope.
I don't really see anything there that would disagree with what I said. The language is simply not precise enough.
But this definitely does. (I'm not ignoring the stack overflow link, but it isn't authoritative.) I ran a test myself, and I am also surprised. I know I tested this long ago, so I am as surprised as that stack overflow answer author and the other commenter. Either I messed up that test or the behavior changed. I probably originally tested it with Java 1.4, but I don't have a JDK that old laying around. I did test with Java 5 and saw the behavior you linked to. TIL.
And then with some renaming, I was able to reproduce the warning with Our build has had |
I looked into the shadow plugin some, and it appears this is difficult/annoying the solve. The plugin sets this configuration in a We may need to "manually" rewrite the JAR file/manifest after the JAR has been created by the shadow plugin. |
@ejona86 Hey, I found this issue debugging the same "bad path element" warning in one of our internal projects where we're using |
In the helloworld example |
We should recommend runtime scope for grpc-netty-shaded. grpc#8606 (comment)
@dapengzhang0 Got it, thank you. Took the liberty of submitting a PR to add the runtime scope to the readme. |
We should recommend runtime scope for grpc-netty-shaded. #8606 (comment)
The generated Class-Path is simply wrong and it will actually be attempted to be used at runtime. Fixes grpc#8606
The generated Class-Path is simply wrong and it will actually be attempted to be used at runtime. Fixes #8606
What version of gRPC-Java are you using?
1.41.0
What is your environment?
JDK 16, Maven version 3.8.1, MacOS Catalina 10.15.7
What did you expect to see?
a clean build of my project
What did you see instead?
Steps to reproduce the bug
I added some other dependencies to an existing project in my
pom.xml
such asThis issue has happened with other projects that we take a dependency on, see here. Taking a look at the
MANIFEST.MF
of the grpc-netty-shaded jar, theClass-Path
attribute is set which seems to be causing the bug.The text was updated successfully, but these errors were encountered: