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

pro build format.pro fails #64

Closed
pacien opened this issue Oct 11, 2018 · 14 comments
Closed

pro build format.pro fails #64

pacien opened this issue Oct 11, 2018 · 14 comments
Assignees

Comments

@pacien
Copy link

pacien commented Oct 11, 2018

 % ./target/pro/bin/pro build format.pro
[pro] registered plugins compiler, convention, docer, formatter, linker, modulefixer, packager, perfer, resolver, runner, tester
[formatter] /home/kea/code/pro-coverage/target/pro/bin/java --module-path /home/kea/code/pro-coverage/target/pro/plugins/formatter/libs --module google.java.format --dry-run
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for /home/kea/code/pro-coverage/target/pro/plugins/formatter/libs/google-java-format-1.6-all-deps.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class com.sun.tools.javac.platform.JDKPlatformProvider not in module
[pro] FAILED !        elapsed time 148 ms
command 'formatter' exit with code 1
State engine terminated.

Version info:

  • pro: master 11d7242
  • jdk: openjdk 11 2018-09-25
@sormuras
Copy link
Collaborator

Mh, iirc, we resorted to the class-path for the google-java-format-1.6-all-deps.jar. It is not intended to be run on the module-path anyway. And I guess, we can't use its programmatic API, yet, as error-prone is still not running on Java 9. This assumption might be outdated, though.

@forax
Copy link
Owner

forax commented Oct 11, 2018

It seems Java 11 is now supported
google/error-prone#860

@sormuras
Copy link
Collaborator

...and I remembered wrongly, the plugin puts google-java-format-1.6-all-deps.jar on the module-path. 😕

@sormuras
Copy link
Collaborator

When using java -jar ... gfj-all-deps.jar <options> variant with the bundled java executable the classloader can't find types that reside with the gfj-all-deps.jar:

target\pro\bin\pro build format.pro

[pro] registered plugins compiler, convention, docer, formatter, linker, modulefixer, packager, perfer, resolver, runner, tester

[formatter] [...]\target\pro\bin\java.exe -jar [...]\target\pro\plugins\formatter\libs\google-java-format-1.6-all-deps.jar --dry-run

java.lang.NoClassDefFoundError: com/google/common/base/Splitter
        at com.google.googlejavaformat.java.CommandLineOptionsParser.<clinit>(CommandLineOptionsParser.java:35)
        at com.google.googlejavaformat.java.Main.processArgs(Main.java:215)
        at com.google.googlejavaformat.java.Main.format(Main.java:89)
        at com.google.googlejavaformat.java.Main.main(Main.java:70)
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Splitter
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 4 more
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Joiner
        at com.google.googlejavaformat.java.UsageException.<clinit>(UsageException.java:24)
        at com.google.googlejavaformat.java.Main.processArgs(Main.java:220)
        at com.google.googlejavaformat.java.Main.format(Main.java:89)
        at com.google.googlejavaformat.java.Main.main(Main.java:70)
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Joiner
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 4 more

Same same when resorting to --class-path [...].jar com.google.googlejavaformat.java.Main <options>

@sormuras
Copy link
Collaborator

Due to com.github.forax.pro.aether.fakeguava providing fake implementations for com.google.common.base and com.google.common.collect...

@forax do you think it is possible to use "real" guava now?

@sormuras
Copy link
Collaborator

...or fake some more types? Methinks, GJF really needs the implementations.

@forax
Copy link
Owner

forax commented Oct 12, 2018

yes, i will work to change the way pro bootstrap aether and remove the fake implementation of guava.
The idea is to sandbox the dependencies so the version used by aether and the one used by any plugins can be different.

@forax
Copy link
Owner

forax commented Oct 16, 2018

see b0e4a82

Aether and all its dependencies are is now frozen into one big jar
https://github.com/forax/pro/blob/master/deps/com.github.forax.pro.aether.jar

So you should be able to use the guava version you want to your plugin.

@sormuras
Copy link
Collaborator

Will try it the coming week.

@sormuras
Copy link
Collaborator

Works locally using the -jar mode within the plugin. Will commit this as a hot-fix solution for now. Might change the plugin implementation later to use the gjf API as intended.

@sormuras
Copy link
Collaborator

Fixed on master via 697fbbf -- can you please re-try @pacien?

@pacien
Copy link
Author

pacien commented Oct 16, 2018

It works!™ Thanks for the fix.

@pacien pacien closed this as completed Oct 16, 2018
@pacien
Copy link
Author

pacien commented Oct 16, 2018

Similarly to #65, format.pro should probably return its success status code.

@forax
Copy link
Owner

forax commented Oct 16, 2018

we accept pull requests :)

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

No branches or pull requests

3 participants