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

Simplifly dealing with jdeps in JlinkPlugin #1372

Open
nigredo-tori opened this issue Oct 13, 2020 · 0 comments
Open

Simplifly dealing with jdeps in JlinkPlugin #1372

nigredo-tori opened this issue Oct 13, 2020 · 0 comments
Labels

Comments

@nigredo-tori
Copy link
Collaborator

This was discussed in passing in a few other issues, but I'd rather have one place to track it.

  1. We feed our whole classpath to jdeps to find which platform modules we need. jdeps, however, requires the modules to form a coherent dependency graph with no missing dependencies. This was the reason for jlinkModules fails for modules that require automatic modules #1293. More recently, I've had a similar thing happen because HikariCP added a module descriptor that requires a lot of dependencies it doesn't bring in through its POM, which makes jdeps fail like this:
    $ jdeps -R --multi-release 11 HikariCP-3.4.5.jar
    Exception in thread "main" java.lang.module.FindException: Module micrometer.core not found, required by com.zaxxer.hikari
    	at java.base/java.lang.module.Resolver.findFail(Resolver.java:877)
    	at java.base/java.lang.module.Resolver.resolve(Resolver.java:191)
    	at java.base/java.lang.module.Resolver.resolve(Resolver.java:140)
    	at java.base/java.lang.module.Configuration.resolve(Configuration.java:422)
    	at java.base/java.lang.module.Configuration.resolve(Configuration.java:256)
    	at jdk.jdeps/com.sun.tools.jdeps.JdepsConfiguration.<init>(JdepsConfiguration.java:117)
    	at jdk.jdeps/com.sun.tools.jdeps.JdepsConfiguration$Builder.build(JdepsConfiguration.java:563)
    	at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.buildConfig(JdepsTask.java:589)
    	at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:543)
    	at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:519)
    	at jdk.jdeps/com.sun.tools.jdeps.Main.main(Main.java:49)
    
    Note that this can't be dealt with using jlinkIgnoreMissingDependencies! There are other workarounds (e.g. micromanaging jlinkBuildImage / fullClassPath), but using those is annoying, it subtly breaks jlinkModules, and it doesn't have anything to do with building an image.
  2. jlinkIgnoreMissingDependencies is annoying. It's a remnant of the first iteration of JlinkPlugin, before we restricted it to only platform modules (JlinkPlugin: restrict linking to platform modules #1248), and I didn't find much use for it so far except for finding missing Jakarta API dependencies. I think this dependency check should be restricted to platform modules/packages only.

Here's a helper plugin I've hacked together to simplify dealing with this stuff: https://gist.github.com/nigredo-tori/3b168da8e3cdcc7766ace3f23e999ec5 . These tweaks can't be adopted into this project as they are - mostly because they use Java 11 - but it should hopefully be useful as a starting point for solving the issues above.

@muuki88 muuki88 added the jlink label Oct 14, 2020
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

2 participants