maven-compiler-plugin
maven-compiler-plugin copied to clipboard
[MCOMPILER-412] Support --process-module-path
remi forax opened MCOMPILER-412 and commented
In the modular world, javac will look for annotation processor in the module-path (only if the annotation processor module is required by the module-info, you can use "required static" or uses with the service) and javac will also look to the --processor-module-path with again a nice separation because the source code doesn't see the module inside the module.
Everything works cleanly if there is no module-info.java, if you have a module-info.java, you have two cases
- your annotation processor is itself a module, if you do a requires on it, Maven will put it in the module-path, so it will work (but there is no nice separation provided by --processor-module-path)
- your annotation processor is not a module, you can do a require on it but Maven will not put it on the module-path because it's not a module, so you have to use the <processor-path> of the Maven compiler plugin
Affects: 3.8.0, 3.8.1
Remote Links:
Robert Scholte commented
I expect this will work exactly the same as for the classpath/modulepath: feed all jars of the annotationProcessorPaths together with the module-info to the locationManager and it'll split up the jars into groups that belong either to the -processorPath or --processor-module-path.
Anand Beh commented
FYI for anyone else who happened across this issue, there is a temporary workaround using the maven-dependency-plugin and specifying the processor-module-path via a property:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>set-processorpath-variable</id>
<phase>initialize</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
<outputProperty>processor-module-path</outputProperty>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<compilerArg>--processor-module-path</compilerArg>
<compilerArg>${processor-module-path}</compilerArg>
</compilerArgs>
</configuration>
</plugin>
This worked for my simple use-case.
Gili commented
Either the parameter name change or there is a typo in the title and description. I think you meant to refer to \--processor-module-path not \--process-module-path.