Open parrt opened 2 years ago
I've encountered the same problem recently: https://stackoverflow.com/questions/70203702/unable-to-build-antlr4-on-ubuntu-due-to-package-is-not-visible-errors (Forgot to add my answer to StackOverflow). But maybe you add not all required arguments. Try adding the following arguments to maven-compiler-plugin
section in the root pom.xml
:
...
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<compilerArgs>
<arg>--add-exports</arg><arg>jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
<arg>--add-exports</arg><arg>jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
<arg>--add-exports</arg><arg>jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
<arg>--add-exports</arg><arg>jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
</compilerArgs>
</configuration>
...
I just created a branch for that but I am trying to figure out why it won't build from a clean. It always fails on the run time tests because that requires the installation of the software, which is Circular dependency... Not sure why they built a tool doesn't figure this out. Let me create the PR and you can take a look.
I'm trying to catch up with antlr now, but I can't get it to build reliably haha.
Also, it seems like Java 7 does not support compilerArgs
in pom. I think it's the right time to update it, see https://github.com/antlr/antlr4/discussions/3369
Can you give me the sequence you used to compile from a fresh clone? I first do this to make sure everything is fresh:
$ rm -rf ~/.m2/repository/org/antlr/antlr4*
$ mvn clean
$ mvn -DskipTests install
The last command there fails trying to build the runtime tests because it's looking for the plug-in or something. The only error I get even with -X is to say compile error. Even this doesn't work when I try to build the individual things:
mvn -X -pl .,antlr4-runtime install
For some reason I can't find the runtime module no matter what I name it. Making other modules like this works.
I remember that I've also failed on mac (not M1) when I've tried it recently. I've ended up with working tool tests but with not working runtime tests. Are tool tests working on your mac? I should get another try but later. Also, you can try to use another version of Java.
But it eventually works fine on my Ubuntu.
Everything works if I use intellij (all hail jetbrains!) but that is using open jdk 1.8 not 16. Meaning that I can compile and run tool and run time tests
See the problem is I have over here https://github.com/antlr/antlr4/pull/3391 when trying to install mvn jar from the command line
Maven is literally beyond my ability to understand. I've wasted three hours so far today and I've made zero progress getting this to compile. On the run time tests I can clean validate and compile but not test or install. It indicates that it gets a compile error despite clearly compiling.
I would love to just leave Java behind at this point because of the build tools
Don't worry, eventually, we'll handle it. But unfortunately, I'm not able to help you now because it's too late for me (after midnight).
Ok, I will try to just build within intellij for now. It looks like it might be a problem to merge the PR because java 8 does not like those parameters or something as it's not compiling.
Ah. it's java 16 trying to process the annotations during compile phase for testing that fails.
Open jdk 1.8 (/Users/parrt/Library/Java/JavaVirtualMachines/liberica-1.8.0_302/bin/java
) in intellij builds no problem (after mvn generates source files from grammars etc...) but jdk 1.8.0 from oracle does not.
I take that back. it's mvn just failing:
[INFO] Reactor Summary for ANTLR 4 4.9.4-SNAPSHOT:
[INFO]
[INFO] ANTLR 4 ............................................ SUCCESS [ 0.820 s]
[INFO] ANTLR 4 Runtime .................................... FAILURE [ 1.293 s]
...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project antlr4-runtime: Compilation failure -> [Help 1]
...
Same error from runtime/Java
dir.
This works with oracle jdk manually compiling:
~/antlr/code/antlr4/runtime/Java/src $ javac -version
javac 1.8.0_311
~/antlr/code/antlr4/runtime/Java/src $ javac -d /tmp org/antlr/v4/runtime/*.java org/antlr/v4/runtime/*/*.java org/antlr/v4/runtime/*/*/*.java
Maybe mvn plugin versions aren't compatible and we need to update all those version nums in poms???
All tests pass in java runtime, python, tool from intellij so far if i just compile not mvn.
I get with this error via command line:
Adding a series of these to
maven-compiler-plugin
from this doc doesn't help: