maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Scholz (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MCOMPILER-310) Different behaviour between JDK 8 / JDK 9 related to annotation processor usage
Date Tue, 02 Jul 2019 10:57:00 GMT

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

Paul Scholz commented on MCOMPILER-310:
---------------------------------------

Behavior did not change while using classpath. This should be a new feature, annotation processing
discovery using the Java 9+ way. This will be acoblished by using --processor-module-path
instead of -processorpath when using module-info.java in a project.

There is also a open issue on the plexus-compiler issue [#53|https://github.com/codehaus-plexus/plexus-compiler/issues/53]
related to this behavior.

> 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
(v7.6.3#76005)

Mime
View raw message