From 3f1374b851cf9e52c8e276248005f21464965a96 Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Fri, 31 May 2019 11:09:13 +0200 Subject: [PATCH] Port to Maven 3 --- pom.xml | 6 +++--- .../remote/RemoteResourcesMojoTest.java | 4 ++++ .../remote/stub/MavenProjectBasicStub.java | 18 +++++++++--------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index deea77c..2203d3b 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ under the License. - 2.2.1 + 3.6.1 3.1.1 3.3 @@ -97,7 +97,7 @@ under the License. org.apache.maven - maven-project + maven-compat ${mavenVersion} @@ -168,7 +168,7 @@ under the License. org.apache.maven.plugin-testing maven-plugin-testing-harness - 1.3 + 3.3.0 test 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 index 8637767..31d50a3 100644 --- a/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java +++ b/src/test/java/org/apache/maven/plugin/resources/remote/RemoteResourcesMojoTest.java @@ -38,6 +38,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; +import java.util.Collections; import java.util.Properties; import java.util.jar.JarOutputStream; import java.util.zip.ZipEntry; @@ -298,6 +299,8 @@ public class RemoteResourcesMojoTest setupDefaultProject( project ); ArtifactRepository repo = (ArtifactRepository) getVariableValueFromObject( mojo, "localRepository" ); + MavenSession session = (MavenSession) getVariableValueFromObject( mojo, "mavenSession" ); + session.getRequest().setLocalRepository( repo ); String path = repo.pathOf( new DefaultArtifact( "test", "test", VersionRange.createFromVersion( "1.1" ), @@ -502,6 +505,7 @@ public class RemoteResourcesMojoTest project.getBasedir().toString(), new Properties(), Calendar.getInstance().getTime() ); + session.setProjects( Collections.singletonList( project ) ); setVariableValueToObject( mojo, "project", project ); setVariableValueToObject( mojo, "outputDirectory", new File( project.getBuild().getOutputDirectory() ) ); 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 index a8a1fad..d0d1fb9 100644 --- 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 @@ -144,15 +144,15 @@ public class MavenProjectBasicStub { // the pom should be located in the isolated dummy root super.setFile( new File( getBasedir(), "pom.xml" ) ); - super.setDependencyArtifacts( new HashSet() ); - super.setArtifacts( new HashSet() ); - super.setPluginArtifacts( new HashSet() ); - super.setReportArtifacts( new HashSet() ); - super.setExtensionArtifacts( new HashSet() ); - super.setRemoteArtifactRepositories( new LinkedList() ); - super.setPluginArtifactRepositories( new LinkedList() ); - super.setCollectedProjects( new LinkedList() ); - super.setActiveProfiles( new LinkedList() ); + super.setDependencyArtifacts( new HashSet() ); + super.setArtifacts( new HashSet() ); + super.setPluginArtifacts( new HashSet() ); + super.setReportArtifacts( new HashSet() ); + super.setExtensionArtifacts( new HashSet() ); + super.setRemoteArtifactRepositories( new LinkedList() ); + super.setPluginArtifactRepositories( new LinkedList() ); + super.setCollectedProjects( new LinkedList() ); + super.setActiveProfiles( new LinkedList() ); super.setOriginalModel( null ); super.setExecutionProject( this ); super.setArtifact( artifact ); -- 2.21.0