|
|
e602a3 |
From 311be5bb7f5c2253ec6233ae48073ecc15d3971a Mon Sep 17 00:00:00 2001
|
|
|
e602a3 |
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
|
|
e602a3 |
Date: Fri, 31 May 2019 11:09:13 +0200
|
|
|
e602a3 |
Subject: [PATCH] Port to Maven 3
|
|
|
e602a3 |
|
|
|
e602a3 |
---
|
|
|
e602a3 |
pom.xml | 6 +++---
|
|
|
e602a3 |
.../remote/RemoteResourcesMojoTest.java | 8 ++++++++
|
|
|
e602a3 |
.../remote/stub/MavenProjectBasicStub.java | 18 +++++++++---------
|
|
|
e602a3 |
3 files changed, 20 insertions(+), 12 deletions(-)
|
|
|
e602a3 |
|
|
|
e602a3 |
diff --git a/pom.xml b/pom.xml
|
|
|
e602a3 |
index deea77c..eafa229 100644
|
|
|
e602a3 |
--- a/pom.xml
|
|
|
e602a3 |
+++ b/pom.xml
|
|
|
e602a3 |
@@ -68,7 +68,7 @@ under the License.
|
|
|
e602a3 |
</distributionManagement>
|
|
|
e602a3 |
|
|
|
e602a3 |
<properties>
|
|
|
e602a3 |
- <mavenVersion>2.2.1</mavenVersion>
|
|
|
e602a3 |
+ <mavenVersion>3.6.2</mavenVersion>
|
|
|
e602a3 |
<mavenFilteringVersion>3.1.1</mavenFilteringVersion>
|
|
|
e602a3 |
<sitePluginVersion>3.3</sitePluginVersion>
|
|
|
e602a3 |
</properties>
|
|
|
e602a3 |
@@ -97,7 +97,7 @@ under the License.
|
|
|
e602a3 |
</dependency>
|
|
|
e602a3 |
<dependency>
|
|
|
e602a3 |
<groupId>org.apache.maven</groupId>
|
|
|
e602a3 |
- <artifactId>maven-project</artifactId>
|
|
|
e602a3 |
+ <artifactId>maven-compat</artifactId>
|
|
|
e602a3 |
<version>${mavenVersion}</version>
|
|
|
e602a3 |
</dependency>
|
|
|
e602a3 |
<dependency>
|
|
|
e602a3 |
@@ -168,7 +168,7 @@ under the License.
|
|
|
e602a3 |
<dependency>
|
|
|
e602a3 |
<groupId>org.apache.maven.plugin-testing</groupId>
|
|
|
e602a3 |
<artifactId>maven-plugin-testing-harness</artifactId>
|
|
|
e602a3 |
- <version>1.3</version>
|
|
|
e602a3 |
+ <version>3.3.0</version>
|
|
|
e602a3 |
<scope>test</scope>
|
|
|
e602a3 |
</dependency>
|
|
|
e602a3 |
<dependency>
|
|
|
e602a3 |
diff --git a/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java b/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java
|
|
|
e602a3 |
index 8637767..f2db4b9 100644
|
|
|
e602a3 |
--- a/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java
|
|
|
e602a3 |
+++ b/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java
|
|
|
e602a3 |
@@ -25,6 +25,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
|
|
|
e602a3 |
import org.apache.maven.artifact.versioning.VersionRange;
|
|
|
e602a3 |
import org.apache.maven.execution.MavenSession;
|
|
|
e602a3 |
import org.apache.maven.execution.ReactorManager;
|
|
|
e602a3 |
+import org.apache.maven.plugin.LegacySupport;
|
|
|
e602a3 |
import org.apache.maven.plugin.resources.remote.stub.MavenProjectResourcesStub;
|
|
|
e602a3 |
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
|
|
|
e602a3 |
import org.apache.maven.project.MavenProject;
|
|
|
e602a3 |
@@ -38,10 +39,12 @@ import java.net.URL;
|
|
|
e602a3 |
import java.util.ArrayList;
|
|
|
e602a3 |
import java.util.Arrays;
|
|
|
e602a3 |
import java.util.Calendar;
|
|
|
e602a3 |
+import java.util.Collections;
|
|
|
e602a3 |
import java.util.Properties;
|
|
|
e602a3 |
import java.util.jar.JarOutputStream;
|
|
|
e602a3 |
import java.util.zip.ZipEntry;
|
|
|
e602a3 |
import org.codehaus.plexus.util.IOUtil;
|
|
|
e602a3 |
+import org.eclipse.aether.DefaultRepositorySystemSession;
|
|
|
e602a3 |
|
|
|
e602a3 |
|
|
|
e602a3 |
/**
|
|
|
e602a3 |
@@ -298,6 +301,8 @@ public class RemoteResourcesMojoTest
|
|
|
e602a3 |
setupDefaultProject( project );
|
|
|
e602a3 |
|
|
|
e602a3 |
ArtifactRepository repo = (ArtifactRepository) getVariableValueFromObject( mojo, "localRepository" );
|
|
|
e602a3 |
+ MavenSession session = (MavenSession) getVariableValueFromObject( mojo, "mavenSession" );
|
|
|
e602a3 |
+ session.getRequest().setLocalRepository( repo );
|
|
|
e602a3 |
String path = repo.pathOf( new DefaultArtifact( "test",
|
|
|
e602a3 |
"test",
|
|
|
e602a3 |
VersionRange.createFromVersion( "1.1" ),
|
|
|
e602a3 |
@@ -502,6 +507,9 @@ public class RemoteResourcesMojoTest
|
|
|
e602a3 |
project.getBasedir().toString(),
|
|
|
e602a3 |
new Properties(),
|
|
|
e602a3 |
Calendar.getInstance().getTime() );
|
|
|
e602a3 |
+ session.setProjects( Collections.singletonList( project ) );
|
|
|
e602a3 |
+ setVariableValueToObject( session, "repositorySession", new DefaultRepositorySystemSession() );
|
|
|
e602a3 |
+ lookup( LegacySupport.class ).setSession( session );
|
|
|
e602a3 |
|
|
|
e602a3 |
setVariableValueToObject( mojo, "project", project );
|
|
|
e602a3 |
setVariableValueToObject( mojo, "outputDirectory", new File( project.getBuild().getOutputDirectory() ) );
|
|
|
e602a3 |
diff --git a/src/test/java/org/apache/maven/plugin/resources/remote/stub/MavenProjectBasicStub.java b/src/test/java/org/apache/maven/plugin/resources/remote/stub/MavenProjectBasicStub.java
|
|
|
e602a3 |
index a8a1fad..d0d1fb9 100644
|
|
|
e602a3 |
--- a/src/test/java/org/apache/maven/plugin/resources/remote/stub/MavenProjectBasicStub.java
|
|
|
e602a3 |
+++ b/src/test/java/org/apache/maven/plugin/resources/remote/stub/MavenProjectBasicStub.java
|
|
|
e602a3 |
@@ -144,15 +144,15 @@ public class MavenProjectBasicStub
|
|
|
e602a3 |
{
|
|
|
e602a3 |
// the pom should be located in the isolated dummy root
|
|
|
e602a3 |
super.setFile( new File( getBasedir(), "pom.xml" ) );
|
|
|
e602a3 |
- super.setDependencyArtifacts( new HashSet<Object>() );
|
|
|
e602a3 |
- super.setArtifacts( new HashSet<Object>() );
|
|
|
e602a3 |
- super.setPluginArtifacts( new HashSet<Object>() );
|
|
|
e602a3 |
- super.setReportArtifacts( new HashSet<Object>() );
|
|
|
e602a3 |
- super.setExtensionArtifacts( new HashSet<Object>() );
|
|
|
e602a3 |
- super.setRemoteArtifactRepositories( new LinkedList<Object>() );
|
|
|
e602a3 |
- super.setPluginArtifactRepositories( new LinkedList<Object>() );
|
|
|
e602a3 |
- super.setCollectedProjects( new LinkedList<Object>() );
|
|
|
e602a3 |
- super.setActiveProfiles( new LinkedList<Object>() );
|
|
|
e602a3 |
+ super.setDependencyArtifacts( new HashSet() );
|
|
|
e602a3 |
+ super.setArtifacts( new HashSet() );
|
|
|
e602a3 |
+ super.setPluginArtifacts( new HashSet() );
|
|
|
e602a3 |
+ super.setReportArtifacts( new HashSet() );
|
|
|
e602a3 |
+ super.setExtensionArtifacts( new HashSet() );
|
|
|
e602a3 |
+ super.setRemoteArtifactRepositories( new LinkedList() );
|
|
|
e602a3 |
+ super.setPluginArtifactRepositories( new LinkedList() );
|
|
|
e602a3 |
+ super.setCollectedProjects( new LinkedList() );
|
|
|
e602a3 |
+ super.setActiveProfiles( new LinkedList() );
|
|
|
e602a3 |
super.setOriginalModel( null );
|
|
|
e602a3 |
super.setExecutionProject( this );
|
|
|
e602a3 |
super.setArtifact( artifact );
|
|
|
e602a3 |
--
|
|
|
e602a3 |
2.21.0
|
|
|
e602a3 |
|