[
https://issues.apache.org/jira/browse/MCOMPILER-310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16351641#comment-16351641
]
Martin Miller edited comment on MCOMPILER-310 at 2/4/18 5:27 AM:
-
Well its not a big issue now that I found out about the change required, but I
lost many hours !
I have my own little Annotation Processor that was working under maven, but as
soon as module-info.java are created, it complained it did not find the
specified in the pom. Compiling by hand did work but not
with maven.
by hand:
/usr/lib/jvm/java-9-jdk/bin/javac -d target/classes -classpath
target/classes:../annotation-processor/target/annotation-processor-1.0-SNAPSHOT.jar
-sourcepath example/src/main/java -target 1.9 -source 1.9
src/main/java/com/test/App.java
I don't know how different maven used javac parameters to compile, but it
didn't work out of the box without the processor paths.
Maybe this should be more documented (java 9 modules + annotation processors
now require paths) ?
was (Author: martinm1000):
Well its not a big issue now that I found out about the change required, but I
lost many hours !
I have my own little Annotation Processor that was working under maven, but as
soon as module-info.java are created, it complained it did not find the
specified in the pom. Compiling by hand did work but not
with maven.{color:#e8bf6a}
{color}
by hand:
/usr/lib/jvm/java-9-jdk/bin/javac -d target/classes -classpath
target/classes:../annotation-processor/target/annotation-processor-1.0-SNAPSHOT.jar
-sourcepath example/src/main/java -target 1.9 -source 1.9
src/main/java/com/test/App.java
I don't know how different maven used javac parameters to compile, but it
didn't work out of the box without the processor paths.
Maybe this should be more documented (java 9 modules + annotation processors
not require paths) ?
> Different behaviour between JDK 8 / JDK 9 related to annotation processor
> usage
> ---
>
> Key: MCOMPILER-310
> URL: https://issues.apache.org/jira/browse/MCOMPILER-310
> Project: Maven Compiler Plugin
> Issue Type: Bug
>Affects Versions: 3.7.0
>Reporter: Karl Heinz Marbaise
>Priority: Critical
>
> Based on the
> [https://stackoverflow.com/questions/46500984/immutables-dont-generate-code-with-java-9-with-modules|SO
> question] is looks like we have a difference in behaviour between JDK 8 /
> JDK 9 related to the picking up of annotation processors.
> If you run the following code under JDK 8 (except for a module-info.java
> file):
> {code:xml}
>
> http://maven.apache.org/POM/4.0.0";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
> 4.0.0
> example
> jigsaw
> 1.0-SNAPSHOT
>
> UTF-8
>
>
>
> org.immutables
> value
> 2.5.6
> provided
>
>
>
>
>
> org.apache.maven.plugins
> maven-compiler-plugin
> 3.7.0
>
>
>
>
> {code}
> The maven-compiler-plugin will automatically pickup the annotation processor
> and produce the classed from the annotation.
> If you run the same with JDK 9 this will not work anymore. Only if you
> explicitly add the annotation processor configuration to
> maven-compiler-plugin it will work as expected:
> {code:xml}
>
> http://maven.apache.org/POM/4.0.0";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
> 4.0.0
> example
> jigsaw
> 1.0-SNAPSHOT
>
> UTF-8
>
>
>
> org.immutables
> value
> 2.5.6
> provided
>
>
>
>
>
> org.apache.maven.plugins
> maven-compiler-plugin
> 3.7.0
>
> 9
> 9
>
>
> org.immutables
> value
> 2.5.6
>
>
>
>
>
>
>
> {code}
> I'm not sure if this is based on the usage of modules (module-path instead of
> classpath)?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)