[ 
https://issues.apache.org/jira/browse/MCOMPILER-310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17342274#comment-17342274
 ] 

Ralph Goers commented on MCOMPILER-310:
---------------------------------------

One issue I have had with Log4j is that in the module where we create the 
annotation processor I have to:
 # Compile the classes with proc=none with no module-info.java to create the 
annotation processor class.
 # Compile the classes with proc=only with no module-info.java to be able to 
find the newly created processor class. If a module-info.java is present the 
annotation processor cannot be located because there is no way to specify the 
current classes directory - it only accepts a dependency.
 # Compile the unit tests without a module-info.java for the same reason.
 # Compile the module-info.java for both the main and tests classes.

Will this change allow the current classes directory to be included in the 
processor path?

> 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 [SO 
> question|https://stackoverflow.com/questions/46500984/immutables-dont-generate-code-with-java-9-with-modules]
>  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}
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="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";>
>     <modelVersion>4.0.0</modelVersion>
>     <groupId>example</groupId>
>     <artifactId>jigsaw</artifactId>
>     <version>1.0-SNAPSHOT</version>
>     <properties>
>       <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>     </properties>
>     <dependencies>
>         <dependency>
>             <groupId>org.immutables</groupId>
>             <artifactId>value</artifactId>
>             <version>2.5.6</version>
>             <scope>provided</scope>
>         </dependency>
>     </dependencies>
>     <build>
>       <plugins>
>         <plugin>
>           <groupId>org.apache.maven.plugins</groupId>
>           <artifactId>maven-compiler-plugin</artifactId>
>           <version>3.7.0</version>
>         </plugin>
>       </plugins>
>     </build>
> </project>
> {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}
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="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";>
>     <modelVersion>4.0.0</modelVersion>
>     <groupId>example</groupId>
>     <artifactId>jigsaw</artifactId>
>     <version>1.0-SNAPSHOT</version>
>     <properties>
>       <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
>     </properties>
>     <dependencies>
>         <dependency>
>             <groupId>org.immutables</groupId>
>             <artifactId>value</artifactId>
>             <version>2.5.6</version>
>             <scope>provided</scope>
>         </dependency>
>     </dependencies>
>     <build>
>       <plugins>
>         <plugin>
>           <groupId>org.apache.maven.plugins</groupId>
>           <artifactId>maven-compiler-plugin</artifactId>
>           <version>3.7.0</version>
>           <configuration>
>             <source>9</source>
>             <target>9</target>
>             <annotationProcessorPaths>
>               <dependency>
>                   <groupId>org.immutables</groupId>
>                   <artifactId>value</artifactId>
>                   <version>2.5.6</version>
>               </dependency>
>             </annotationProcessorPaths>
>           </configuration>
>         </plugin>
>       </plugins>
>     </build>
> </project>
> {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
(v8.3.4#803005)

Reply via email to