You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2023/01/30 00:51:46 UTC
[maven-compiler-plugin] branch master updated: [MCOMPILER-503] Resolve all annotation processor dependencies together (#170)
This is an automated email from the ASF dual-hosted git repository.
olamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 3f95d39 [MCOMPILER-503] Resolve all annotation processor dependencies together (#170)
3f95d39 is described below
commit 3f95d39f166809bc1a2bb0b2fa62c190e8d2a9f7
Author: Petr Široký <pe...@pm.me>
AuthorDate: Mon Jan 30 01:51:40 2023 +0100
[MCOMPILER-503] Resolve all annotation processor dependencies together (#170)
* [MCOMPILER-503] Resolve all annotation processor dependencies together
* resolving the anootation processor paths in multiple requests can easily
lead to duplicated dependencies, e.g. if two processors depend on
the same transitive dependency. Ultimately, both versions would end-up on
processorpath, but of course only one of them would be used
(likely dependeing on the order of elements of processorpath)
* the previous behavior also did match the general rules of dependency
resolution used by Maven itself and other plugins
* this may potentially be a breaking change for certain corner cases,
if for example some projects mistakenly rely on the order of elemenets in
processorpath
* [MCOMPILER-503] Extract and reuse annotation-verify-plugin in multiple ITs
---
pom.xml | 7 +-
src/it/MCOMPILER-157/annotation-user/pom.xml | 6 +-
src/it/MCOMPILER-157/annotation-verify/pom.xml | 130 ------------
src/it/MCOMPILER-157/pom.xml | 1 -
.../annotation-user/pom.xml | 6 +-
.../main/java/org/issue/SourcePathReadGoal.java | 107 ----------
src/it/MCOMPILER-203-processorpath/pom.xml | 1 -
.../annotation-processor-dep-v1/pom.xml | 34 ++++
.../AnnotationProcessorDependencyV1.java | 23 +++
.../annotation-processor-dep-v2/pom.xml | 35 ++++
.../AnnotationProcessorDependencyV2.java | 23 +++
.../annotation-processor/pom.xml | 41 ++++
.../mcompiler503/SimpleAnnotationProcessor.java | 121 ++++++++++++
.../annotation-user/pom.xml | 78 ++++++++
.../main/java/mcompiler503/SimpleAnnotation.java | 30 +++
.../src/main/java/mcompiler503/SimpleObject.java | 24 +++
.../test/java/mcompiler503/SimpleTestObject.java | 24 +++
.../invoker.properties | 18 ++
.../pom.xml | 49 +++++
.../invoker.properties | 18 ++
.../pom.xml | 218 +++++++++------------
.../SourcePathReadGoal.java | 13 +-
.../plugin/compiler/AbstractCompilerMojo.java | 51 ++---
23 files changed, 653 insertions(+), 405 deletions(-)
diff --git a/pom.xml b/pom.xml
index a3f6746..992a2d9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -249,13 +249,8 @@ under the License.
! https://issues.apache.org/jira/browse/MINVOKER-174
-->
<setupIncludes>
- <setupInclude>setup_jar_module/pom.xml</setupInclude>
- <setupInclude>setup_jar_automodule/pom.xml</setupInclude>
- <setupInclude>setup_x/pom.xml</setupInclude>
+ <setupInclude>setup*/pom.xml</setupInclude>
</setupIncludes>
- <setupExcludes>
- <setupExclude>setup_x/**</setupExclude>
- </setupExcludes>
<postBuildHookScript>verify</postBuildHookScript>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<settingsFile>src/it/settings.xml</settingsFile>
diff --git a/src/it/MCOMPILER-157/annotation-user/pom.xml b/src/it/MCOMPILER-157/annotation-user/pom.xml
index 69066f7..9d304fe 100644
--- a/src/it/MCOMPILER-157/annotation-user/pom.xml
+++ b/src/it/MCOMPILER-157/annotation-user/pom.xml
@@ -58,9 +58,9 @@ under the License.
</configuration>
</plugin>
<plugin>
- <groupId>org.issue</groupId>
- <artifactId>annotation-verify</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>annotation-verify-plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
<executions>
<execution>
<id>verify-annotations</id>
diff --git a/src/it/MCOMPILER-157/annotation-verify/pom.xml b/src/it/MCOMPILER-157/annotation-verify/pom.xml
deleted file mode 100644
index ddfeab3..0000000
--- a/src/it/MCOMPILER-157/annotation-verify/pom.xml
+++ /dev/null
@@ -1,130 +0,0 @@
-<?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.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>
-
- <parent>
- <groupId>org.issue</groupId>
- <artifactId>compiler-test</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>annotation-verify</artifactId>
- <packaging>maven-plugin</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.issue</groupId>
- <artifactId>annotation-processor</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-annotations</artifactId>
- <version>3.3</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>@mavenVersion@</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- <version>@mavenVersion@</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-core</artifactId>
- <version>@mavenVersion@</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.maven.reporting</groupId>
- <artifactId>maven-reporting-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-file</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-http-lightweight</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ssh</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ssh-external</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-cli</groupId>
- <artifactId>commons-cli</artifactId>
- </exclusion>
- <exclusion>
- <groupId>classworlds</groupId>
- <artifactId>classworlds</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-interactivity-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-shared-utils</artifactId>
- <version>3.3.3</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-plugin-plugin</artifactId>
- <version>@mavenPluginPluginVersion@</version>
- <configuration>
- <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
- </configuration>
- <executions>
- <execution>
- <id>mojo-descriptor</id>
- <phase>process-classes</phase>
- <goals>
- <goal>descriptor</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
\ No newline at end of file
diff --git a/src/it/MCOMPILER-157/pom.xml b/src/it/MCOMPILER-157/pom.xml
index e5494e8..9b2e756 100644
--- a/src/it/MCOMPILER-157/pom.xml
+++ b/src/it/MCOMPILER-157/pom.xml
@@ -31,7 +31,6 @@ under the License.
<modules>
<module>annotation-processor</module>
- <module>annotation-verify</module>
<module>annotation-user</module>
</modules>
diff --git a/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml b/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml
index 80d94fe..42cb899 100644
--- a/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml
+++ b/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml
@@ -63,9 +63,9 @@ under the License.
</configuration>
</plugin>
<plugin>
- <groupId>org.issue</groupId>
- <artifactId>annotation-verify</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>annotation-verify-plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
<executions>
<execution>
<id>verify-annotations</id>
diff --git a/src/it/MCOMPILER-203-processorpath/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java b/src/it/MCOMPILER-203-processorpath/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java
deleted file mode 100644
index 971870f..0000000
--- a/src/it/MCOMPILER-203-processorpath/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.issue;
-
-/*
- * 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.
- */
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.utils.StringUtils;
-import org.apache.maven.shared.utils.io.FileUtils;
-
-@Mojo( name = "read-source", defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES )
-public class SourcePathReadGoal
- extends AbstractMojo
-{
-
- @Parameter
- protected String sourceClass;
-
- @Parameter
- protected String testSourceClass;
-
- @Parameter( defaultValue = "${project}" )
- protected MavenProject project;
-
- @SuppressWarnings( "unchecked" )
- public void execute()
- throws MojoExecutionException, MojoFailureException
- {
- if ( sourceClass != null )
- {
- getLog().info( "Checking compile source roots for: '" + sourceClass + "'" );
- assertGeneratedSourceFileFor( sourceClass, project.getCompileSourceRoots() );
- }
-
- if ( testSourceClass != null )
- {
- getLog().info( "Checking test-compile source roots for: '" + testSourceClass + "'" );
- assertGeneratedSourceFileFor( testSourceClass, project.getTestCompileSourceRoots() );
- }
- }
-
- private void assertGeneratedSourceFileFor( String sourceClass, List<String> sourceRoots )
- throws MojoFailureException, MojoExecutionException
- {
- String sourceFile = sourceClass.replace( '.', '/' )
- .concat( ".txt" );
-
- boolean found = false;
- for ( String root : sourceRoots )
- {
- File f = new File( root, sourceFile );
- getLog().info( "Looking for: " + f );
- if ( f.exists() )
- {
- try
- {
- String[] nameParts = sourceClass.split( "\\." );
- String content = FileUtils.fileRead( f );
- if ( !nameParts[nameParts.length-1].equals( content ) )
- {
- throw new MojoFailureException( "Non-matching content in: " + f + "\n expected: '"
- + sourceClass + "'\n found: '" + content + "'" );
- }
-
- found = true;
- break;
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "Cannot read contents of: " + f, e );
- }
- }
- }
-
- if ( !found )
- {
- throw new MojoFailureException( "Cannot find generated source file: " + sourceFile + " in:\n "
- + StringUtils.join( sourceRoots.iterator(), "\n " ) );
- }
- }
-
-}
diff --git a/src/it/MCOMPILER-203-processorpath/pom.xml b/src/it/MCOMPILER-203-processorpath/pom.xml
index 350f032..3f312d8 100644
--- a/src/it/MCOMPILER-203-processorpath/pom.xml
+++ b/src/it/MCOMPILER-203-processorpath/pom.xml
@@ -31,7 +31,6 @@ under the License.
<modules>
<module>annotation-processor</module>
- <module>annotation-verify</module>
<module>annotation-user</module>
</modules>
diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v1/pom.xml b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v1/pom.xml
new file mode 100644
index 0000000..6f87e71
--- /dev/null
+++ b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v1/pom.xml
@@ -0,0 +1,34 @@
+<?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.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>
+
+ <parent>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>mcompiler503-test</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>mcompiler503-annotation-processor-dep</artifactId>
+
+</project>
diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v1/src/main/java/mcompiler503/AnnotationProcessorDependencyV1.java b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v1/src/main/java/mcompiler503/AnnotationProcessorDependencyV1.java
new file mode 100644
index 0000000..3df98c4
--- /dev/null
+++ b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v1/src/main/java/mcompiler503/AnnotationProcessorDependencyV1.java
@@ -0,0 +1,23 @@
+package mcompiler503;
+/*
+ * 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.
+ */
+
+public class AnnotationProcessorDependencyV1
+{
+}
\ No newline at end of file
diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v2/pom.xml b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v2/pom.xml
new file mode 100644
index 0000000..d363bd2
--- /dev/null
+++ b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v2/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.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>
+
+ <parent>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>mcompiler503-test</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>mcompiler503-annotation-processor-dep</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+
+</project>
diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v2/src/main/java/mcompiler503/AnnotationProcessorDependencyV2.java b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v2/src/main/java/mcompiler503/AnnotationProcessorDependencyV2.java
new file mode 100644
index 0000000..43f09f3
--- /dev/null
+++ b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v2/src/main/java/mcompiler503/AnnotationProcessorDependencyV2.java
@@ -0,0 +1,23 @@
+package mcompiler503;
+/*
+ * 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.
+ */
+
+public class AnnotationProcessorDependencyV2
+{
+}
\ No newline at end of file
diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor/pom.xml b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor/pom.xml
new file mode 100644
index 0000000..ed0e490
--- /dev/null
+++ b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor/pom.xml
@@ -0,0 +1,41 @@
+<?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.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>
+
+ <parent>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>mcompiler503-test</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>mcompiler503-annotation-processor</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>mcompiler503-annotation-processor-dep</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor/src/main/java/mcompiler503/SimpleAnnotationProcessor.java b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor/src/main/java/mcompiler503/SimpleAnnotationProcessor.java
new file mode 100644
index 0000000..05f205c
--- /dev/null
+++ b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor/src/main/java/mcompiler503/SimpleAnnotationProcessor.java
@@ -0,0 +1,121 @@
+package mcompiler503;
+/*
+ * 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.
+ */
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Set;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.Filer;
+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.Element;
+import javax.lang.model.element.Name;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.util.Elements;
+import javax.tools.FileObject;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardLocation;
+
+@SupportedSourceVersion( SourceVersion.RELEASE_6 )
+@SupportedAnnotationTypes( "mcompiler503.SimpleAnnotation" )
+public class SimpleAnnotationProcessor
+ extends AbstractProcessor
+{
+
+ @Override
+ public boolean process( Set<? extends TypeElement> annotations, RoundEnvironment roundEnv )
+ {
+ if ( annotations.isEmpty() )
+ {
+ return true;
+ }
+
+ // assert that mcompiler503-annotation-processor-dep:2.0.0-SNAPSHOT is on the classpath
+ try
+ {
+ getClass().getClassLoader().loadClass( "mcompiler503.AnnotationProcessorDependencyV2" );
+ }
+ catch ( ClassNotFoundException expected )
+ {
+ throw new RuntimeException( "Expected mcompiler503.AnnotationProcessorDependencyV2 to be on the"
+ + "processorpath, because mcompiler503-annotation-processor-dep:2.0.0-SNAPSHOT is specifically"
+ + "configured as one the elements of the processorpath." );
+ }
+
+ // assert that mcompiler503-annotation-processor-dep:1.0.0-SNAPSHOT is NOT on the classpath,
+ // since it should be replaced by mcompiler503-annotation-processor-dep:2.0.0-SNAPSHOT
+ // when resolving annotation processors and their dependencies
+ try
+ {
+ getClass().getClassLoader().loadClass( "mcompiler503.AnnotationProcessorDependencyV1" );
+ throw new RuntimeException( "Expected a ClassNotFoundException, because "
+ + "mcompiler503.AnnotationProcessorDependencyV1 is not supposed to be on the processorpath." );
+ }
+ catch ( ClassNotFoundException expected )
+ {
+ // expected.
+ }
+
+ Filer filer = processingEnv.getFiler();
+
+ Elements elementUtils = processingEnv.getElementUtils();
+
+ Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith( annotations.iterator().next() );
+
+ for ( Element element : elements )
+ {
+ Name name = element.getSimpleName();
+
+ PackageElement packageElement = elementUtils.getPackageOf( element );
+
+ try
+ {
+ Name packageName = packageElement.getQualifiedName();
+ FileObject resource =
+ filer.createResource( StandardLocation.SOURCE_OUTPUT, packageName, name + ".txt", element );
+
+ Writer writer = resource.openWriter();
+ writer.write( name.toString() );
+ writer.close();
+
+ String className = name + "Companion";
+ JavaFileObject javaFile = filer.createSourceFile( packageName + "." + className, element );
+
+ Writer javaWriter = javaFile.openWriter();
+ javaWriter.append( "package " ).append( packageName ).append( ";\n\n" );
+ javaWriter.append( "public class " ).append( className ).append( " {\n" );
+ javaWriter.append( " public " ).append( className ).append( "() {\n" );
+ javaWriter.append( " System.out.println(\"Hey there!\");\n" );
+ javaWriter.append( " }\n}\n" );
+ javaWriter.close();
+ }
+ catch ( IOException e )
+ {
+ throw new RuntimeException( e );
+ }
+ }
+
+ return !elements.isEmpty();
+ }
+}
diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/pom.xml b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/pom.xml
new file mode 100644
index 0000000..111eca2
--- /dev/null
+++ b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/pom.xml
@@ -0,0 +1,78 @@
+<?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.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>
+
+ <parent>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>mcompiler503-test</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>mcompiler503-annotation-user</artifactId>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessors>
+ <annotationProcessor>mcompiler503.SimpleAnnotationProcessor</annotationProcessor>
+ </annotationProcessors>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>mcompiler503-annotation-processor</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </path>
+ <path>
+ <!-- This version should override / replace the 'mcompiler503-annotation-processor-dep:1.0.0-SNAPSHOT'
+ which is a dependency of 'mcompiler503-annotation-processor' -->
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>mcompiler503-annotation-processor-dep</artifactId>
+ <version>2.0.0-SNAPSHOT</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>annotation-verify-plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>verify-annotations</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>read-source</goal>
+ </goals>
+ <configuration>
+ <sourceClass>mcompiler503.SimpleObject</sourceClass>
+ <testSourceClass>mcompiler503.SimpleTestObject</testSourceClass>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/main/java/mcompiler503/SimpleAnnotation.java b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/main/java/mcompiler503/SimpleAnnotation.java
new file mode 100644
index 0000000..7264938
--- /dev/null
+++ b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/main/java/mcompiler503/SimpleAnnotation.java
@@ -0,0 +1,30 @@
+package mcompiler503;
+/*
+ * 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.
+ */
+
+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/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/main/java/mcompiler503/SimpleObject.java b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/main/java/mcompiler503/SimpleObject.java
new file mode 100644
index 0000000..faa913f
--- /dev/null
+++ b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/main/java/mcompiler503/SimpleObject.java
@@ -0,0 +1,24 @@
+package mcompiler503;
+/*
+ * 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.
+ */
+
+@SimpleAnnotation
+public class SimpleObject
+{
+}
diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/test/java/mcompiler503/SimpleTestObject.java b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/test/java/mcompiler503/SimpleTestObject.java
new file mode 100644
index 0000000..5c47d30
--- /dev/null
+++ b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/test/java/mcompiler503/SimpleTestObject.java
@@ -0,0 +1,24 @@
+package mcompiler503;
+/*
+ * 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.
+ */
+
+@SimpleAnnotation
+public class SimpleTestObject
+{
+}
diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/invoker.properties b/src/it/MCOMPILER-503-processorpath-duplicated-deps/invoker.properties
new file mode 100644
index 0000000..a0a3964
--- /dev/null
+++ b/src/it/MCOMPILER-503-processorpath-duplicated-deps/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=process-test-classes
diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/pom.xml b/src/it/MCOMPILER-503-processorpath-duplicated-deps/pom.xml
new file mode 100644
index 0000000..85fd2ba
--- /dev/null
+++ b/src/it/MCOMPILER-503-processorpath-duplicated-deps/pom.xml
@@ -0,0 +1,49 @@
+<?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.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>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>mcompiler503-test</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>annotation-processor-dep-v1</module>
+ <module>annotation-processor-dep-v2</module>
+ <module>annotation-processor</module>
+ <module>annotation-user</module>
+ </modules>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>@project.version@</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/src/it/setup_annotation-verify-plugin/invoker.properties b/src/it/setup_annotation-verify-plugin/invoker.properties
new file mode 100644
index 0000000..d5d6ca5
--- /dev/null
+++ b/src/it/setup_annotation-verify-plugin/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 = install
diff --git a/src/it/MCOMPILER-203-processorpath/annotation-verify/pom.xml b/src/it/setup_annotation-verify-plugin/pom.xml
similarity index 53%
rename from src/it/MCOMPILER-203-processorpath/annotation-verify/pom.xml
rename to src/it/setup_annotation-verify-plugin/pom.xml
index 691526d..f6ae99b 100644
--- a/src/it/MCOMPILER-203-processorpath/annotation-verify/pom.xml
+++ b/src/it/setup_annotation-verify-plugin/pom.xml
@@ -1,123 +1,95 @@
-<?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.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>
-
- <parent>
- <groupId>org.issue</groupId>
- <artifactId>compiler-test</artifactId>
- <version>1.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>annotation-verify</artifactId>
- <packaging>maven-plugin</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.plugin-tools</groupId>
- <artifactId>maven-plugin-annotations</artifactId>
- <version>3.3</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>@mavenVersion@</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- <version>@mavenVersion@</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-core</artifactId>
- <version>@mavenVersion@</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.maven.reporting</groupId>
- <artifactId>maven-reporting-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-file</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-http-lightweight</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ssh</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ssh-external</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-cli</groupId>
- <artifactId>commons-cli</artifactId>
- </exclusion>
- <exclusion>
- <groupId>classworlds</groupId>
- <artifactId>classworlds</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-container-default</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-interactivity-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-shared-utils</artifactId>
- <version>3.3.3</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-plugin-plugin</artifactId>
- <version>@mavenPluginPluginVersion@</version>
- <configuration>
- <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
- </configuration>
- <executions>
- <execution>
- <id>mojo-descriptor</id>
- <phase>process-classes</phase>
- <goals>
- <goal>descriptor</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
+<?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.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>org.apache.maven.plugins.compiler.it</groupId>
+ <artifactId>annotation-verify-plugin</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>3.3</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>@mavenVersion@</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>@mavenVersion@</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>@mavenVersion@</version>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.maven.reporting</groupId>
+ <artifactId>maven-reporting-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-file</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-http-lightweight</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-ssh</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-ssh-external</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>classworlds</groupId>
+ <artifactId>classworlds</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-interactivity-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/src/it/MCOMPILER-157/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java b/src/it/setup_annotation-verify-plugin/src/main/java/org.apache.maven.plugins.compiler.it/SourcePathReadGoal.java
similarity index 92%
rename from src/it/MCOMPILER-157/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java
rename to src/it/setup_annotation-verify-plugin/src/main/java/org.apache.maven.plugins.compiler.it/SourcePathReadGoal.java
index aafec6f..668809a 100644
--- a/src/it/MCOMPILER-157/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java
+++ b/src/it/setup_annotation-verify-plugin/src/main/java/org.apache.maven.plugins.compiler.it/SourcePathReadGoal.java
@@ -1,5 +1,4 @@
-package org.issue;
-
+package org.apache.maven.plugins.compiler.it;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -21,7 +20,9 @@ package org.issue;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Files;
import java.util.List;
+import java.util.StringJoiner;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoFailureException;
@@ -30,8 +31,6 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.utils.StringUtils;
-import org.apache.maven.shared.utils.io.FileUtils;
@Mojo( name = "read-source", defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES )
public class SourcePathReadGoal
@@ -80,13 +79,12 @@ public class SourcePathReadGoal
try
{
String[] nameParts = sourceClass.split( "\\." );
- String content = FileUtils.fileRead( f );
+ String content = new String( Files.readAllBytes( f.toPath() ) );
if ( !nameParts[nameParts.length-1].equals( content ) )
{
throw new MojoFailureException( "Non-matching content in: " + f + "\n expected: '"
+ sourceClass + "'\n found: '" + content + "'" );
}
-
found = true;
break;
}
@@ -100,8 +98,7 @@ public class SourcePathReadGoal
if ( !found )
{
throw new MojoFailureException( "Cannot find generated source file: " + sourceFile + " in:\n "
- + StringUtils.join( sourceRoots.iterator(), "\n " ) );
+ + String.join( "\n ", sourceRoots ) );
}
}
-
}
diff --git a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
index 19265a7..03cd6af 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
@@ -1802,32 +1802,20 @@ public abstract class AbstractCompilerMojo
return null;
}
+ Set<String> elements = new LinkedHashSet<>();
try
{
- Set<String> elements = new LinkedHashSet<>();
- for ( DependencyCoordinate coord : annotationProcessorPaths )
+ List<Dependency> dependencies = convertToDependencies( annotationProcessorPaths );
+ CollectRequest collectRequest = new CollectRequest( dependencies, Collections.emptyList(),
+ project.getRemoteProjectRepositories() );
+ DependencyRequest dependencyRequest = new DependencyRequest();
+ dependencyRequest.setCollectRequest( collectRequest );
+ DependencyResult dependencyResult = repositorySystem.resolveDependencies(
+ session.getRepositorySession(), dependencyRequest );
+
+ for ( ArtifactResult resolved : dependencyResult.getArtifactResults() )
{
- ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( coord.getType() );
-
- Artifact artifact = new DefaultArtifact(
- coord.getGroupId(),
- coord.getArtifactId(),
- coord.getClassifier(),
- handler.getExtension(),
- coord.getVersion()
- );
-
- CollectRequest collectRequest = new CollectRequest( new Dependency( artifact, JavaScopes.RUNTIME ),
- project.getRemoteProjectRepositories() );
- DependencyRequest dependencyRequest = new DependencyRequest();
- dependencyRequest.setCollectRequest( collectRequest );
- DependencyResult dependencyResult = repositorySystem.resolveDependencies(
- session.getRepositorySession(), dependencyRequest );
-
- for ( ArtifactResult resolved : dependencyResult.getArtifactResults() )
- {
- elements.add( resolved.getArtifact().getFile().getAbsolutePath() );
- }
+ elements.add( resolved.getArtifact().getFile().getAbsolutePath() );
}
return new ArrayList<>( elements );
}
@@ -1838,6 +1826,23 @@ public abstract class AbstractCompilerMojo
}
}
+ private List<Dependency> convertToDependencies( List<DependencyCoordinate> annotationProcessorPaths )
+ {
+ List<Dependency> dependencies = new ArrayList<>();
+ for ( DependencyCoordinate annotationProcessorPath : annotationProcessorPaths )
+ {
+ ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( annotationProcessorPath.getType() );
+ Artifact artifact = new DefaultArtifact(
+ annotationProcessorPath.getGroupId(),
+ annotationProcessorPath.getArtifactId(),
+ annotationProcessorPath.getClassifier(),
+ handler.getExtension(),
+ annotationProcessorPath.getVersion() );
+ dependencies.add( new Dependency( artifact, JavaScopes.RUNTIME ) );
+ }
+ return dependencies;
+ }
+
private void writePlugin( MessageBuilder mb )
{
mb.a( " <plugin>" ).newline();