This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch maven-4.1
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git
The following commit(s) were added to refs/heads/maven-4.1 by this push:
new ec14b74 test: add integration test for modular processor with shared
dependencies
ec14b74 is described below
commit ec14b7448bfb2683f881cd21e4d3ac48d16c6921
Author: mariuszs <[email protected]>
AuthorDate: Fri Mar 27 14:28:56 2026 +0100
test: add integration test for modular processor with shared dependencies
Regression test for #1039.
The fix belongs in Maven core (apache/maven#11805).
---
.../annotation-user/pom.xml | 47 +++++++++++++++++++++
.../annotation-user/src/main/java/module-info.java | 21 ++++++++++
.../src/main/java/user/SimpleAnnotation.java | 28 +++++++++++++
.../src/main/java/user/SimpleObject.java | 28 +++++++++++++
.../invoker.properties | 18 ++++++++
.../modular-processor/pom.xml | 35 ++++++++++++++++
.../src/main/java/module-info.java | 25 +++++++++++
.../src/main/java/processor/SimpleProcessor.java | 43 +++++++++++++++++++
src/it/modular-processor-shared-dep/pom.xml | 48 ++++++++++++++++++++++
.../shared-lib/pom.xml | 28 +++++++++++++
.../shared-lib/src/main/java/module-info.java | 21 ++++++++++
.../src/main/java/sharedlib/SharedUtil.java | 25 +++++++++++
src/it/modular-processor-shared-dep/verify.groovy | 23 +++++++++++
13 files changed, 390 insertions(+)
diff --git a/src/it/modular-processor-shared-dep/annotation-user/pom.xml
b/src/it/modular-processor-shared-dep/annotation-user/pom.xml
new file mode 100644
index 0000000..472236e
--- /dev/null
+++ b/src/it/modular-processor-shared-dep/annotation-user/pom.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0
http://maven.apache.org/xsd/maven-4.1.0.xsd">
+ <modelVersion>4.1.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>modular-processor-shared-dep</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>annotation-user</artifactId>
+ <dependencies>
+ <!--
+ shared-lib is used both directly by this project (modular-jar on
module-path)
+ and transitively by modular-processor (which needs it on
processor-module-path).
+ This reproduces
https://github.com/apache/maven-compiler-plugin/issues/1039
+ -->
+ <dependency>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>shared-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <type>modular-jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>modular-processor</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <type>modular-processor</type>
+ </dependency>
+ </dependencies>
+</project>
diff --git
a/src/it/modular-processor-shared-dep/annotation-user/src/main/java/module-info.java
b/src/it/modular-processor-shared-dep/annotation-user/src/main/java/module-info.java
new file mode 100644
index 0000000..86fda5a
--- /dev/null
+++
b/src/it/modular-processor-shared-dep/annotation-user/src/main/java/module-info.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+module user.app {
+ requires shared.lib;
+}
diff --git
a/src/it/modular-processor-shared-dep/annotation-user/src/main/java/user/SimpleAnnotation.java
b/src/it/modular-processor-shared-dep/annotation-user/src/main/java/user/SimpleAnnotation.java
new file mode 100644
index 0000000..46baa6f
--- /dev/null
+++
b/src/it/modular-processor-shared-dep/annotation-user/src/main/java/user/SimpleAnnotation.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package user;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+@Retention(RetentionPolicy.SOURCE)
+public @interface SimpleAnnotation {}
diff --git
a/src/it/modular-processor-shared-dep/annotation-user/src/main/java/user/SimpleObject.java
b/src/it/modular-processor-shared-dep/annotation-user/src/main/java/user/SimpleObject.java
new file mode 100644
index 0000000..e3fd2e5
--- /dev/null
+++
b/src/it/modular-processor-shared-dep/annotation-user/src/main/java/user/SimpleObject.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package user;
+
+import sharedlib.SharedUtil;
+
+@SimpleAnnotation
+public class SimpleObject {
+ public String hello() {
+ return SharedUtil.greet("world");
+ }
+}
diff --git a/src/it/modular-processor-shared-dep/invoker.properties
b/src/it/modular-processor-shared-dep/invoker.properties
new file mode 100644
index 0000000..29d3dcf
--- /dev/null
+++ b/src/it/modular-processor-shared-dep/invoker.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.goals=compile
diff --git a/src/it/modular-processor-shared-dep/modular-processor/pom.xml
b/src/it/modular-processor-shared-dep/modular-processor/pom.xml
new file mode 100644
index 0000000..0258823
--- /dev/null
+++ b/src/it/modular-processor-shared-dep/modular-processor/pom.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0
http://maven.apache.org/xsd/maven-4.1.0.xsd">
+ <modelVersion>4.1.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>modular-processor-shared-dep</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>modular-processor</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>shared-lib</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git
a/src/it/modular-processor-shared-dep/modular-processor/src/main/java/module-info.java
b/src/it/modular-processor-shared-dep/modular-processor/src/main/java/module-info.java
new file mode 100644
index 0000000..447e7b6
--- /dev/null
+++
b/src/it/modular-processor-shared-dep/modular-processor/src/main/java/module-info.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+module modular.processor {
+ requires shared.lib;
+ requires java.compiler;
+
+ provides javax.annotation.processing.Processor with
+ processor.SimpleProcessor;
+}
diff --git
a/src/it/modular-processor-shared-dep/modular-processor/src/main/java/processor/SimpleProcessor.java
b/src/it/modular-processor-shared-dep/modular-processor/src/main/java/processor/SimpleProcessor.java
new file mode 100644
index 0000000..c6ef709
--- /dev/null
+++
b/src/it/modular-processor-shared-dep/modular-processor/src/main/java/processor/SimpleProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package processor;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.TypeElement;
+
+import java.util.Set;
+
+import sharedlib.SharedUtil;
+
+@SupportedSourceVersion(SourceVersion.RELEASE_17)
+@SupportedAnnotationTypes("user.SimpleAnnotation")
+public class SimpleProcessor extends AbstractProcessor {
+ public SimpleProcessor() {}
+
+ @Override
+ public boolean process(Set<? extends TypeElement> annotations,
RoundEnvironment roundEnv) {
+ // Use SharedUtil to verify the transitive dependency is accessible.
+ SharedUtil.greet("test");
+ return false;
+ }
+}
diff --git a/src/it/modular-processor-shared-dep/pom.xml
b/src/it/modular-processor-shared-dep/pom.xml
new file mode 100644
index 0000000..6fef732
--- /dev/null
+++ b/src/it/modular-processor-shared-dep/pom.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0
http://maven.apache.org/xsd/maven-4.1.0.xsd">
+ <modelVersion>4.1.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>modular-processor-shared-dep</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <release>17</release>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <subprojects>
+ <subproject>shared-lib</subproject>
+ <subproject>modular-processor</subproject>
+ <subproject>annotation-user</subproject>
+ </subprojects>
+</project>
diff --git a/src/it/modular-processor-shared-dep/shared-lib/pom.xml
b/src/it/modular-processor-shared-dep/shared-lib/pom.xml
new file mode 100644
index 0000000..b27f1af
--- /dev/null
+++ b/src/it/modular-processor-shared-dep/shared-lib/pom.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0
http://maven.apache.org/xsd/maven-4.1.0.xsd">
+ <modelVersion>4.1.0</modelVersion>
+ <parent>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>modular-processor-shared-dep</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>shared-lib</artifactId>
+</project>
diff --git
a/src/it/modular-processor-shared-dep/shared-lib/src/main/java/module-info.java
b/src/it/modular-processor-shared-dep/shared-lib/src/main/java/module-info.java
new file mode 100644
index 0000000..79f7a7a
--- /dev/null
+++
b/src/it/modular-processor-shared-dep/shared-lib/src/main/java/module-info.java
@@ -0,0 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+module shared.lib {
+ exports sharedlib;
+}
diff --git
a/src/it/modular-processor-shared-dep/shared-lib/src/main/java/sharedlib/SharedUtil.java
b/src/it/modular-processor-shared-dep/shared-lib/src/main/java/sharedlib/SharedUtil.java
new file mode 100644
index 0000000..ff569eb
--- /dev/null
+++
b/src/it/modular-processor-shared-dep/shared-lib/src/main/java/sharedlib/SharedUtil.java
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package sharedlib;
+
+public class SharedUtil {
+ public static String greet(String name) {
+ return "Hello, " + name;
+ }
+}
diff --git a/src/it/modular-processor-shared-dep/verify.groovy
b/src/it/modular-processor-shared-dep/verify.groovy
new file mode 100644
index 0000000..a038263
--- /dev/null
+++ b/src/it/modular-processor-shared-dep/verify.groovy
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+def classFile = new File(basedir,
'annotation-user/target/classes/user/SimpleObject.class')
+assert classFile.exists() : "SimpleObject.class should have been compiled"
+
+def moduleInfo = new File(basedir,
'annotation-user/target/classes/module-info.class')
+assert moduleInfo.exists() : "module-info.class should have been compiled"