diff --git a/pom.xml b/pom.xml index ca7b8764..2595c924 100644 --- a/pom.xml +++ b/pom.xml @@ -63,7 +63,10 @@ - 3.0 + 3.2.5 + 1.7.32 + 1.1.0 + 2.22.2 7 2020-04-07T21:04:00Z @@ -73,13 +76,21 @@ org.apache.maven maven-plugin-api ${mavenVersion} + provided org.apache.maven maven-artifact ${mavenVersion} + provided + + + + org.apache.maven + maven-core + ${mavenVersion} + provided - org.apache.maven.shared maven-artifact-transfer @@ -96,13 +107,13 @@ junit junit - 4.13.1 + 4.13.2 test org.apache.maven.plugin-testing maven-plugin-testing-harness - 2.1 + 3.3.0 test @@ -120,13 +131,31 @@ org.slf4j slf4j-api - 1.7.30 + ${slf4jVersion} provided org.slf4j slf4j-nop - 1.7.30 + ${slf4jVersion} + test + + + org.eclipse.aether + aether-api + ${aetherVersion} + test + + + org.eclipse.aether + aether-util + ${aetherVersion} + test + + + org.eclipse.aether + aether-impl + ${aetherVersion} test @@ -150,6 +179,7 @@ org.apache.maven.plugins maven-invoker-plugin + 3.2.2 ${project.build.directory}/it true diff --git a/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java b/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java index 8b3b070b..bf040b15 100644 --- a/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/install/InstallFileMojoTest.java @@ -26,13 +26,14 @@ import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.plugin.testing.AbstractMojoTestCase; -import org.apache.maven.plugins.install.InstallFileMojo; import org.apache.maven.project.DefaultProjectBuildingRequest; import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.shared.utils.ReaderFactory; import org.apache.maven.shared.utils.io.FileUtils; -import org.sonatype.aether.impl.internal.EnhancedLocalRepositoryManager; -import org.sonatype.aether.util.DefaultRepositorySystemSession; +import org.eclipse.aether.DefaultRepositorySystemSession; +import org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManagerFactory; +import org.eclipse.aether.repository.LocalRepository; +import org.eclipse.aether.repository.NoLocalRepositoryManagerException; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -280,12 +281,16 @@ private String dotToSlashReplacer( String parameter ) { return parameter.replace( '.', '/' ); } - - private MavenSession createMavenSession() + + private MavenSession createMavenSession() throws NoLocalRepositoryManagerException { MavenSession session = mock( MavenSession.class ); DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); - repositorySession.setLocalRepositoryManager( new EnhancedLocalRepositoryManager( new File( LOCAL_REPO ) ) ); + repositorySession.setLocalRepositoryManager( + new EnhancedLocalRepositoryManagerFactory().newInstance( + repositorySession, new LocalRepository( LOCAL_REPO ) + ) + ); ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest(); buildingRequest.setRepositorySession( repositorySession ); when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest ); diff --git a/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java b/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java index 63ac6fa9..ed73d2cb 100644 --- a/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java +++ b/src/test/java/org/apache/maven/plugins/install/InstallMojoTest.java @@ -38,8 +38,10 @@ import org.apache.maven.project.ProjectBuildingRequest; import org.apache.maven.shared.transfer.repository.RepositoryManager; import org.apache.maven.shared.utils.io.FileUtils; -import org.sonatype.aether.impl.internal.EnhancedLocalRepositoryManager; -import org.sonatype.aether.util.DefaultRepositorySystemSession; +import org.eclipse.aether.DefaultRepositorySystemSession; +import org.eclipse.aether.internal.impl.EnhancedLocalRepositoryManagerFactory; +import org.eclipse.aether.repository.LocalRepository; +import org.eclipse.aether.repository.NoLocalRepositoryManagerException; /** * @author Allan Ramirez @@ -85,7 +87,7 @@ public void testBasicInstall() MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" ); updateMavenProject( project ); - + setVariableValueToObject( mojo, "reactorProjects", Collections.singletonList( project ) ); setVariableValueToObject( mojo, "session", createMavenSession() ); @@ -343,11 +345,15 @@ private String dotToSlashReplacer( String parameter ) return parameter.replace( '.', '/' ); } - private MavenSession createMavenSession() + private MavenSession createMavenSession() throws NoLocalRepositoryManagerException { MavenSession session = mock( MavenSession.class ); DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); - repositorySession.setLocalRepositoryManager( new EnhancedLocalRepositoryManager( new File( LOCAL_REPO ) ) ); + repositorySession.setLocalRepositoryManager( + new EnhancedLocalRepositoryManagerFactory().newInstance( + repositorySession, new LocalRepository( LOCAL_REPO ) + ) + ); ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest(); buildingRequest.setRepositorySession( repositorySession ); when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest );