Open mnd999 opened 4 years ago
Module config:
{
"version": "1.4.0",
"project": {
"name": "annotations",
"directory": "/home/mark/neo4j/neo4j-4.2/public/annotations",
"workspaceDir": "/home/mark/neo4j/neo4j-4.2",
"sources": [
"/home/mark/neo4j/neo4j-4.2/public/annotations/src/main/java"
],
"dependencies": [
],
"classpath": [
"/home/mark/neo4j/neo4j-4.2/public/annotations/target/classes",
"/home/mark/.m2/repository/org/eclipse/collections/eclipse-collections/10.2.0/eclipse-collections-10.2.0.jar",
"/home/mark/.m2/repository/org/eclipse/collections/eclipse-collections-api/10.2.0/eclipse-collections-api-10.2.0.jar",
"/home/mark/.m2/repository/org/apache/commons/commons-lang3/3.10/commons-lang3-3.10.jar",
"/home/mark/.m2/repository/junit/junit/4.13/junit-4.13.jar"
],
"out": "/home/mark/neo4j/neo4j-4.2/public/annotations/target",
"classesDir": "/home/mark/neo4j/neo4j-4.2/public/annotations/target/classes",
"resources": [
"/home/mark/neo4j/neo4j-4.2/public/annotations/target/classes/META-INF",
"/home/mark/neo4j/neo4j-4.2/public/annotations/target/classes/META-INF"
],
"scala": {
"organization": "org.scala-lang",
"name": "scala-compiler",
"version": "2.12.10",
"options": [
],
"jars": [
],
"setup": {
"order": "mixed",
"addLibraryToBootClasspath": true,
"addCompilerToClasspath": false,
"addExtraJarsToClasspath": false,
"manageBootClasspath": true,
"filterLibraryFromClasspath": true
}
},
"java": {
"options": [
"-g",
"-target",
"11",
"-source",
"11",
"-encoding",
"UTF-8",
"-proc:none",
"--add-exports",
"jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED",
"-Xpkginfo:always"
]
},
"test": {
"frameworks": [
{
"names": [
"com.novocode.junit.JUnitFramework"
]
},
{
"names": [
"org.scalatest.tools.Framework",
"org.scalatest.tools.ScalaTestFramework"
]
},
{
"names": [
"org.scalacheck.ScalaCheckFramework"
]
},
{
"names": [
"org.specs.runner.SpecsFramework",
"org.specs2.runner.Specs2Framework",
"org.specs2.runner.SpecsFramework"
]
},
{
"names": [
"utest.runner.Framework"
]
},
{
"names": [
"munit.Framework"
]
}
],
"options": {
"excludes": [
],
"arguments": [
{
"args": [
"-v",
"-a"
],
"framework": {
"names": [
"com.novocode.junit.JUnitFramework"
]
}
}
]
}
},
"platform": {
"name": "jvm",
"config": {
"home": "/usr/lib/jvm/java-11-openjdk",
"options": [
]
},
"mainClass": [
]
},
"tags": [
"library"
]
}
}%
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. At this point, I've only figured out how to build the Maven plugin so I don't think I can take this any further quickly.
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 java->scala
option to the compile order field of the bloop configuration file. Let me know if this works!
@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.