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
Javac plugins cannot be found #215
Comments
I was running into a similar issue - your sample project helped me debug this and find the root cause. Your plugin is being discovered by the The reason for this is that your plugin resides in the
You might want to add the following line to your provides com.sun.source.util.Plugin with sample.SamplePlugin; BTW, |
@netdpb When I originally opened the issue, the @Test
public void withPlugin() {
Compilation compilation = Compiler.javac()
.withOptions("-Xplugin:SamplePlugin")
.withAnnotationProcessorPath(List.of(new File("target/classes")))
.withClasspath(List.of(new File("target/classes")))
.compile(JavaFileObjects.forResource("HelloWorld.java"));
CompilationSubject.assertThat(compilation).succeeded();
} Thank you @elkkhan for the explanation and the suggested modifications, your fix indeed works. I don't know whether this issue should be closed or not. On the one hand, adding the With that being said, I think this issue should be closed. Users can be expected to configure their modules correctly (to include the necessary |
@Trigary I believe compilation through cmd-line |
It looks to me like this isn't an issue with Compile Testing per se, but a constraint on how JPMS works, so I'll close this issue. Please reopen if I've misunderstood. |
I am trying to use this library to unit test a
javac
plugin.The plugin works fine when compilation is done through
javac
directly:javac src/test/resources/HelloWorld.java -Xplugin:SamplePlugin -cp 'target/classes/'
But the following unit test fails:
The classpath itself is correct, as demonstrated by these unit tests:
I have uploaded this minimalistic sample Maven project to help the confirmation and the reproduction of this issue: Sample.zip
The text was updated successfully, but these errors were encountered: