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

JarInputStream fails to get Manifest from published mockito-core #2108

Closed
hdecarne opened this issue Nov 23, 2020 · 4 comments
Closed

JarInputStream fails to get Manifest from published mockito-core #2108

hdecarne opened this issue Nov 23, 2020 · 4 comments

Comments

@hdecarne
Copy link
Contributor

Using mockito-core in a JPMS based gradle build fails due to a known but odd behaviour of JarInputStream. The latter only provides access to the Jar's manifest if it is the 1st or 2nd entry in the Jar. As discussed in:

As gradle uses the JarInputStream to get the manifest and to determine whether the Automatic-Module-Name attribute is set, it fails to add mockito-core to the module path (see GRADLE #15270. Same issue was observed for Quarkus #5399. The attached example code example.zip shows this issue.

An optimal solution would be to make sure the manifest file is kept at the Jar's beginning during the publication process.

Used versions:

  • mockito-core-3.6.0.jar
  • java version "11.0.6" 2020-01-14 LTS
    Java(TM) SE Runtime Environment 18.9 (build 11.0.6+8-LTS)
    Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.6+8-LTS, mixed mode)
@TimvdLippe
Copy link
Contributor

@mockitoguy might be able to provide more insight, but I think we create our Jar on this line:

javaLibrary(MavenPublication) { //name of the publication

We would welcome PRs for this issue. Hopefully the link provides enough context to figure out how to resolve the problem?

@joeshannon
Copy link
Contributor

The commit message for fde5abb includes [ci maven-central-release] - should this cause a release to be published to maven central?
I can't see a new release there at the moment, not sure if there is usually a delay?

@TimvdLippe
Copy link
Contributor

It should have, but it seems like it incorrectly concluded it didn't include the message. Filed #2110

@mockitoguy
Copy link
Member

On it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants