-
Notifications
You must be signed in to change notification settings - Fork 4
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
Can't compile java with --add-exports
option in Maven
#26
Comments
Module config:
|
--add-exports
option in Maven
Thanks for reporting! It's the first time I see that error. I recommend you try to move a minimal example of your javac setup in Maven to a build tool like gradle or sbt and check the generated configuration file. Off the top of my head, I'm not sure what can be missing. The compile order you configure your project with might also matter here, try playing with it too. |
I added more stack trace, I don't think it's Maven specific, running javac with the bloop generated CLI manually seems to work but the bloop / zinc compiler seems to trip up when it hits the bit of code that requires the add exports. |
I don't think zinc has ever been tested with this javac option so I'm not surprised it doesn't work. Maybe Maven is doing something special here to make this option work. I don't have the time to have at this but if I was to keep investigating I would look at the maven-scala plugin and look if they are doing something there to make this option, or the scala-java compile integration, work. |
@mnd999 I think what's going on here is that this option adds magic imports to Javac and therefore the Scala compiler that can compile Java signatures fails because it doesn't recognize this option. This is an error that should be reported upstream to scala/scala. The reason why this works in Maven though is because Maven is compiling this module only with the Java compiler, thanks to java->scala being the default compile order in Maven. The way you can force this in bloop is by exporting the |
@jvican I'm not convinced. I've added some detection and setting of the compile order to my branch https://github.com/mnd999/bloop/tree/generate-maven-java-modules and it doesn't seem to make much difference. Even in the log above, javac is getting invoked and completing successfully. It seems to be some other process coming in after that to do some analysis that seems to trip up. Maybe it is an upstream thing, but I don't think I understand it enough just yet. If I bloop compile a module that depends on the one that fails, for example, it compiles annotations, then the dependent module and after that it comes back to do this next step and then blows up. |
When I try to compile a module with some dubious module usage, I get errors in bloom:
If I compile the same module with Maven it's fine.
The bloop config for this was generated using my branch https://github.com/mnd999/bloop/tree/generate-maven-java-modules as bloop won't support this out of the box.
It could be that I'm just generating the config wrong.
The text was updated successfully, but these errors were encountered: