You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2018/09/07 11:14:57 UTC

[maven-compiler-plugin] branch plexus-java-1.0.0 created (now d6e157e)

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a change to branch plexus-java-1.0.0
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git.


      at d6e157e  Upgrade plexus-java to 1.0.0

This branch includes the following new commits:

     new d6e157e  Upgrade plexus-java to 1.0.0

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-compiler-plugin] 01/01: Upgrade plexus-java to 1.0.0

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch plexus-java-1.0.0
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git

commit d6e157e9e15f61a22cdac1d2d11dcaa4b63540a1
Author: rfscholte <rf...@apache.org>
AuthorDate: Fri Sep 7 13:14:48 2018 +0200

    Upgrade plexus-java to 1.0.0
---
 pom.xml                                                          | 4 ++--
 .../org/apache/maven/plugin/compiler/AbstractCompilerMojo.java   | 9 +++++++++
 src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java | 9 ++-------
 .../java/org/apache/maven/plugin/compiler/TestCompilerMojo.java  | 9 ++-------
 .../org/apache/maven/plugin/compiler/CompilerMojoTestCase.java   | 8 ++++++++
 5 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/pom.xml b/pom.xml
index e7b8b0e..2152c72 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,7 +26,7 @@ under the License.
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-plugins</artifactId>
     <version>32</version>
-    <relativePath>../../pom/maven/maven-plugins/pom.xml</relativePath>
+    <relativePath/>
   </parent>
 
   <artifactId>maven-compiler-plugin</artifactId>
@@ -129,7 +129,7 @@ under the License.
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-java</artifactId>
-      <version>0.9.10</version>
+      <version>1.0.0-SNAPSHOT</version>
     </dependency>
 
     <dependency>
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 9295499..894039f 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
@@ -80,6 +80,7 @@ import org.codehaus.plexus.compiler.util.scan.mapping.SingleTargetSourceMapping;
 import org.codehaus.plexus.compiler.util.scan.mapping.SourceMapping;
 import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
 import org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor;
+import org.codehaus.plexus.languages.java.jpms.LocationManager;
 import org.codehaus.plexus.languages.java.version.JavaVersion;
 
 /**
@@ -503,6 +504,9 @@ public abstract class AbstractCompilerMojo
      */
     @Component
     private ResolutionErrorHandler resolutionErrorHandler;
+    
+    // @Inject + Java9+ + maven-plugin-testing-harness-2.1 doesn't work 
+    private LocationManager locationManager = new LocationManager();
 
     protected abstract SourceInclusionScanner getSourceInclusionScanner( int staleMillis );
 
@@ -1750,6 +1754,11 @@ public abstract class AbstractCompilerMojo
 
         return pomProperties.getProperty( "version" );
     }
+    
+    protected LocationManager getLocationManager()
+    {
+        return locationManager;
+    }
 
     public void setTarget( String target )
     {
diff --git a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
index 1d3eebf..4743dfe 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
@@ -33,7 +33,6 @@ import java.util.Map.Entry;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
@@ -47,10 +46,9 @@ import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
 import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
 import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
 import org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor;
-import org.codehaus.plexus.languages.java.jpms.LocationManager;
 import org.codehaus.plexus.languages.java.jpms.ResolvePathsRequest;
 import org.codehaus.plexus.languages.java.jpms.ResolvePathsResult;
-import org.codehaus.plexus.languages.java.jpms.ResolvePathsResult.ModuleNameSource;
+import org.codehaus.plexus.languages.java.jpms.ModuleNameSource;
 
 /**
  * Compiles application sources
@@ -125,9 +123,6 @@ public class CompilerMojo
     @Parameter
     private boolean multiReleaseOutput;
 
-    @Component
-    private LocationManager locationManager;
-
     private List<String> classpathElements;
 
     private List<String> modulepathElements;
@@ -236,7 +231,7 @@ public class CompilerMojo
                     request.setJdkHome( new File( ( (DefaultJavaToolChain) toolchain ).getJavaHome() ) );
                 }
 
-                resolvePathsResult = locationManager.resolvePaths( request );
+                resolvePathsResult = getLocationManager().resolvePaths( request );
                 
                 for ( Entry<File, Exception> pathException : resolvePathsResult.getPathExceptions().entrySet() )
                 {
diff --git a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
index 7fbe75d..857792e 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
@@ -34,7 +34,6 @@ import java.util.Map.Entry;
 import java.util.Set;
 
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
@@ -45,7 +44,6 @@ import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
 import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
 import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
 import org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor;
-import org.codehaus.plexus.languages.java.jpms.LocationManager;
 import org.codehaus.plexus.languages.java.jpms.ResolvePathsRequest;
 import org.codehaus.plexus.languages.java.jpms.ResolvePathsResult;
 
@@ -161,9 +159,6 @@ public class TestCompilerMojo
     @Parameter( defaultValue = "${project.testClasspathElements}", readonly = true )
     private List<String> testPath;
 
-    @Component
-    private LocationManager locationManager;
-
     private Map<String, JavaModuleDescriptor> pathElements;
     
     private Collection<String> classpathElements;
@@ -247,7 +242,7 @@ public class TestCompilerMojo
                     request.setJdkHome( ( (DefaultJavaToolChain) toolchain ).getJavaHome() );
                 }
 
-                result = locationManager.resolvePaths( request );
+                result = getLocationManager().resolvePaths( request );
                 
                 for ( Entry<String, Exception> pathException : result.getPathExceptions().entrySet() )
                 {
@@ -291,7 +286,7 @@ public class TestCompilerMojo
                     request.setJdkHome( ( (DefaultJavaToolChain) toolchain ).getJavaHome() );
                 }
 
-                result = locationManager.resolvePaths( request );
+                result = getLocationManager().resolvePaths( request );
             }
             catch ( IOException e )
             {
diff --git a/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java b/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java
index 8ae1dc6..77cd919 100644
--- a/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java
+++ b/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java
@@ -46,6 +46,7 @@ import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugin.testing.stubs.ArtifactStub;
 import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.ContainerConfiguration;
 
 public class CompilerMojoTestCase
     extends AbstractMojoTestCase
@@ -73,6 +74,13 @@ public class CompilerMojoTestCase
         }
     }
     
+    @Override
+    protected ContainerConfiguration setupContainerConfiguration()
+    {
+        // to support @Inject while using maven-plugin-testing-harness-2.1 
+        return super.setupContainerConfiguration().setClassPathScanning( true );
+    }
+    
     /**
      * tests the ability of the plugin to compile a basic file
      *