-
Notifications
You must be signed in to change notification settings - Fork 16
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
java.lang.ClassNotFoundException during GrammarInitializer instantiation #20
Comments
The initial idea I have to fix the problem is to add a parameter to the method getClassLoader() and pass "/target/classes" or "/target/test-classes" if instantiating a Lexer/Parser or a GrammarInitializer. Will take a closer look at the code to check if its a good approach. |
gilcesarf
added a commit
to gilcesarf/antlr4test-maven-plugin
that referenced
this issue
Apr 22, 2020
gilcesarf
added a commit
to gilcesarf/antlr4test-maven-plugin
that referenced
this issue
Apr 22, 2020
gilcesarf
added a commit
to gilcesarf/antlr4test-maven-plugin
that referenced
this issue
Apr 22, 2020
Already fixed the issue. Waiting on PR to close issue |
teverett
added a commit
that referenced
this issue
May 30, 2021
…n.plugins-maven-javadoc-plugin-3.3.0 Bump maven-javadoc-plugin from 3.2.0 to 3.3.0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have created a new scenario and configured a GrammarInitializer implemented inside my src/test/java root. A ClassNotFound exception was raised as at the end.
I investigated the problem and it is caused because of this snippet inside com.khubla.antlr.antlr4test.Scenario class:
This is the code used to get a classloader to load the Lexer and Parser. It points explicitly to "/target/classes". But when the GrammarInitializer is put inside /src/test/java, the corresponding .class gets compiled to "/target/test-classes", so it cannot be found.
Until I fix this, a possible workaround is to put the GrammarInitializer implementation inside the main source project root: src/main/java
This workaround solved the ClassNotFoundException. Its drawback is that GrammarInitializer class would be distributed with the .jar of the project.
The text was updated successfully, but these errors were encountered: