You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "svpace (via GitHub)" <gi...@apache.org> on 2025/04/12 04:52:04 UTC
[I] annotationProcessorPaths "leak" version from parent to child pom [maven-compiler-plugin]
svpace opened a new issue, #325:
URL: https://github.com/apache/maven-compiler-plugin/issues/325
### Affected version
3.14.0
### Bug description
Not quite sure if this should be reported here or in the Maven Jira. But as it seems to be related to #180 reporting here first. Please let me know if I should report there.
When a parent POM or `pluginManagement` defines a set of annotation processors with versions, and the child POM or `plugins` defines another set of processors without versions (relying on `dependencyManagement`), the version is inherited from the processor defined at the corresponding position in the list instead of the dependency management.
The following POM shows the issue:
```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>com.example</groupId>
<artifactId>maven-compiler-plugin-issue</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.6.3</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.38</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
```
The resulting effective POM end up like this:
```xml
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.18.38</version>
</path>
</annotationProcessorPaths>
</configuration>
</execution>
```
If I omit the `groupId` from `plugins` it also inherits it from parent. It feels like Maven's list and non-list merge behavior gets mixed up and it replaces the list but fills in any missing fields.
I am pretty sure that a `combine.children` or `combine.self` may workaround this, but the current way fells wrong.
Let me know if you need any more infos.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] annotationProcessorPaths "leak" version from parent to child pom [maven-compiler-plugin]
Posted by "wilx (via GitHub)" <gi...@apache.org>.
wilx commented on issue #325:
URL: https://github.com/apache/maven-compiler-plugin/issues/325#issuecomment-4951716406
I think this is fixed in Maven 4.x and unifxable in 3.x.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] annotationProcessorPaths "leak" version from parent to child pom [maven-compiler-plugin]
Posted by "frommeyerc (via GitHub)" <gi...@apache.org>.
frommeyerc commented on issue #325:
URL: https://github.com/apache/maven-compiler-plugin/issues/325#issuecomment-3654321341
I stumbled over this as well. [Here](https://github.com/frommeyerc/wrong-processor-versions) is also a repository with a small setup to reproduce the issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org