You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2020/02/02 12:51:02 UTC

[maven] branch MNG-6856 updated (952b67f -> c927032)

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

slachiewicz pushed a change to branch MNG-6856
in repository https://gitbox.apache.org/repos/asf/maven.git.


 discard 952b67f  [MNG-6856] Remove dependency to Powermock
     add cdb2cd0  [MNG-6071] Normalize relative paths for working directory
     add 720e46d  Revert "[MNG-5587] When the build fails emit any errors without the user having to specify -e or -X"
     add 45076f3  Improve license handling
     add 35658fd  Run Integration Tests with Java 8, 11, 13 and 14
     add 716cc1f  [MNG-5669] same pom.xml is read multiple times
     new c927032  [MNG-6856] Remove dependency to Powermock

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (952b67f)
            \
             N -- N -- N   refs/heads/MNG-6856 (c927032)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

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.


Summary of changes:
 Jenkinsfile                                        |   6 +-
 apache-maven/pom.xml                               |   6 +-
 .../main/appended-resources/META-INF/LICENSE.vm    |  19 +-
 .../licenses/{ASL-2.0.txt => Apache-2.0.txt}       |   0
 apache-maven/src/main/assembly/component.xml       |   1 +
 .../java/org/apache/maven/building/FileSource.java |  31 ++++
 .../org/apache/maven/building/StringSource.java    |  33 +++-
 .../java/org/apache/maven/building/UrlSource.java  |  32 +++-
 .../apache/maven/project/ReactorModelCache.java    |  78 +++++++-
 .../main/java/org/apache/maven/cli/MavenCli.java   |   1 +
 .../java/org/apache/maven/cli/ResolveFile.java     |   3 +-
 .../maven/model/building/ArtifactModelSource.java  |  27 ++-
 .../maven/model/building/DefaultModelBuilder.java  | 206 ++++++++++++++++-----
 .../maven/model/building/FileModelSource.java      |   9 +-
 .../apache/maven/model/building/ModelCache.java    |  29 +++
 .../apache/maven/model/building/ModelCacheTag.java |  26 +++
 .../model/superpom/DefaultSuperPomProvider.java    |   2 +-
 .../StringSearchModelInterpolatorTest.java         |  36 ++--
 .../internal/DefaultArtifactDescriptorReader.java  |   7 +-
 .../repository/internal/DefaultModelResolver.java  |   7 +-
 20 files changed, 454 insertions(+), 105 deletions(-)
 rename apache-maven/src/main/appended-resources/licenses/{ASL-2.0.txt => Apache-2.0.txt} (100%)
 copy maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java => maven-model-builder/src/main/java/org/apache/maven/model/building/ArtifactModelSource.java (69%)


[maven] 01/01: [MNG-6856] Remove dependency to Powermock

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

slachiewicz pushed a commit to branch MNG-6856
in repository https://gitbox.apache.org/repos/asf/maven.git

commit c92703280776bcd4b519fec578f1ac69cfd5fbdd
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sun Jan 26 16:59:44 2020 +0100

    [MNG-6856] Remove dependency to Powermock
---
 maven-model-builder/pom.xml                        |  5 ---
 .../StringSearchModelInterpolatorTest.java         | 52 +++++++++++-----------
 pom.xml                                            |  6 ---
 3 files changed, 26 insertions(+), 37 deletions(-)

diff --git a/maven-model-builder/pom.xml b/maven-model-builder/pom.xml
index a2145d2..81d2587 100644
--- a/maven-model-builder/pom.xml
+++ b/maven-model-builder/pom.xml
@@ -84,11 +84,6 @@ under the License.
       <artifactId>xmlunit-matchers</artifactId>
       <scope>test</scope>
     </dependency>
-    <dependency>
-      <groupId>org.powermock</groupId>
-      <artifactId>powermock-reflect</artifactId>
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <build>
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java
index cf38d30..479f681 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java
@@ -27,6 +27,7 @@ import org.apache.maven.model.building.ModelBuildingRequest;
 import org.apache.maven.model.building.SimpleProblemCollector;
 
 import java.io.File;
+import java.lang.reflect.Field;
 import java.util.*;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
@@ -35,13 +36,14 @@ import java.util.concurrent.FutureTask;
 
 import static org.hamcrest.CoreMatchers.anyOf;
 import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.powermock.reflect.Whitebox.getField;
-import static org.powermock.reflect.Whitebox.getInternalState;
+import static org.hamcrest.MatcherAssert.assertThat;
 
 /**
+ * StringSearchModelInterpolatorTest - not in use
+ *
  * @author jdcasey
  * @author Benjamin Bentmann
+ * @deprecated replaced by StringVisitorModelInterpolator (MNG-6697)
  */
 public class StringSearchModelInterpolatorTest
     extends AbstractModelInterpolatorTest
@@ -59,19 +61,16 @@ public class StringSearchModelInterpolatorTest
 
 
     protected ModelInterpolator createInterpolator( org.apache.maven.model.path.PathTranslator translator )
-        throws Exception
     {
         return this.interpolator;
     }
 
     protected ModelInterpolator createInterpolator()
-        throws Exception
     {
         return this.interpolator;
     }
 
     public void testInterpolateStringArray()
-        throws Exception
     {
         Model model = new Model();
 
@@ -101,7 +100,6 @@ public class StringSearchModelInterpolatorTest
     }
 
     public void testInterpolateObjectWithStringArrayField()
-        throws Exception
     {
         Model model = new Model();
 
@@ -126,7 +124,6 @@ public class StringSearchModelInterpolatorTest
     }
 
     public void testInterpolateObjectWithStringListField()
-        throws Exception
     {
         Model model = new Model();
 
@@ -153,7 +150,6 @@ public class StringSearchModelInterpolatorTest
     }
 
     public void testInterpolateObjectWithStringListFieldAndOneLiteralValue()
-        throws Exception
     {
         Model model = new Model();
 
@@ -180,7 +176,6 @@ public class StringSearchModelInterpolatorTest
     }
 
     public void testInterpolateObjectWithUnmodifiableStringListField()
-        throws Exception
     {
         Model model = new Model();
 
@@ -204,7 +199,6 @@ public class StringSearchModelInterpolatorTest
     }
 
     public void testInterpolateObjectWithStringArrayListField()
-        throws Exception
     {
         Model model = new Model();
 
@@ -235,7 +229,6 @@ public class StringSearchModelInterpolatorTest
     }
 
     public void testInterpolateObjectWithStringToStringMapField()
-        throws Exception
     {
         Model model = new Model();
 
@@ -262,7 +255,6 @@ public class StringSearchModelInterpolatorTest
     }
 
     public void testInterpolateObjectWithStringToStringMapFieldAndOneLiteralValue()
-        throws Exception
     {
         Model model = new Model();
 
@@ -289,7 +281,6 @@ public class StringSearchModelInterpolatorTest
     }
 
     public void testInterpolateObjectWithUnmodifiableStringToStringMapField()
-        throws Exception
     {
         Model model = new Model();
 
@@ -313,7 +304,6 @@ public class StringSearchModelInterpolatorTest
     }
 
     public void testInterpolateObjectWithStringToStringArrayMapField()
-        throws Exception
     {
         Model model = new Model();
 
@@ -393,10 +383,7 @@ public class StringSearchModelInterpolatorTest
         interpolator.interpolateObject( obj, model, new File( "." ), config, collector );
         assertProblemFree( collector );
 
-        //noinspection unchecked
-        Map<Class<?>, ?> cache =
-                (Map<Class<?>, ?>) getField( StringSearchModelInterpolator.class, "CACHED_ENTRIES" )
-                        .get( null );
+        Map<Class<?>, ?> cache = getCachedEntries();
 
         Object objCacheItem = cache.get( Object.class );
         Object fileCacheItem = cache.get( File.class );
@@ -404,8 +391,24 @@ public class StringSearchModelInterpolatorTest
         assertNotNull( objCacheItem );
         assertNotNull( fileCacheItem );
 
-        assertThat( ( (Object[]) getInternalState( objCacheItem, "fields" ) ).length, is( 0 ) );
-        assertThat( ( (Object[]) getInternalState( fileCacheItem, "fields" ) ).length, is( 0 ) );
+        assertThat( readFieldsArray( objCacheItem ).length, is( 0 ) );
+        assertThat( readFieldsArray( fileCacheItem ).length, is( 0 ) );
+    }
+
+    private static Object[] readFieldsArray( Object o ) throws NoSuchFieldException, IllegalAccessException
+    {
+        assertNotNull( o );
+        Field field = o.getClass().getDeclaredField( "fields" );
+        field.setAccessible( true );
+        return (Object[]) field.get( o );
+    }
+
+    private static Map<Class<?>, ?> getCachedEntries() throws NoSuchFieldException, IllegalAccessException
+    {
+        Field field = StringSearchModelInterpolator.class.getDeclaredField( "CACHED_ENTRIES" );
+        field.setAccessible( true );
+        //noinspection unchecked
+        return (Map<Class<?>, ?>) field.get( null );
     }
 
     public void testNotInterpolateFile()
@@ -425,16 +428,13 @@ public class StringSearchModelInterpolatorTest
         interpolator.interpolateObject( baseDir, model, new File( "." ), config, collector );
         assertProblemFree( collector );
 
-        //noinspection unchecked
-        Map<Class<?>, ?> cache =
-                (Map<Class<?>, ?>) getField( StringSearchModelInterpolator.class, "CACHED_ENTRIES" )
-                        .get( null );
+        Map<Class<?>, ?> cache = getCachedEntries();
 
         Object fileCacheItem = cache.get( File.class );
 
         assertNotNull( fileCacheItem );
 
-        assertThat( ( (Object[]) getInternalState( fileCacheItem, "fields" ) ).length, is( 0 ) );
+        assertThat( readFieldsArray( fileCacheItem ).length, is( 0 ) );
     }
 
 
diff --git a/pom.xml b/pom.xml
index 3148a97..cbb1e33 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,7 +68,6 @@ under the License.
     <resolverVersion>1.4.1</resolverVersion>
     <slf4jVersion>1.7.29</slf4jVersion>
     <xmlunitVersion>2.2.1</xmlunitVersion>
-    <powermockVersion>1.7.4</powermockVersion>
     <maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
     <!-- Control the name of the distribution and information output by mvn -->
     <distributionId>apache-maven</distributionId>
@@ -420,11 +419,6 @@ under the License.
         <scope>test</scope>
       </dependency>
       <dependency>
-        <groupId>org.powermock</groupId>
-        <artifactId>powermock-reflect</artifactId>
-        <version>${powermockVersion}</version>
-      </dependency>
-      <dependency>
         <groupId>org.hamcrest</groupId>
         <artifactId>hamcrest-core</artifactId>
         <version>2.2</version>