From d5d222e0a0e0450762d68d9926c251574071b23e Mon Sep 17 00:00:00 2001 From: Joseph Walton Date: Sat, 20 Apr 2019 22:29:25 +1000 Subject: [PATCH] Remove unused code that triggers Error Prone (#245) Running Error Prone over Maven triggers an infinite recursion check in AbstractCoreMavenComponentTestCase.PluginBuilder; on inspection, the class is unused. Remove it, along with the commented- out (since bc257a588e) reference to it. --- .../AbstractCoreMavenComponentTestCase.java | 53 ------------------- .../maven/plugin/PluginManagerTest.java | 22 -------- 2 files changed, 75 deletions(-) diff --git a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java index 315e15217c8d..179b8f974180 100644 --- a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java +++ b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java @@ -327,57 +327,4 @@ public MavenProject get() return project; } } - - protected class PluginBuilder - { - private Plugin plugin; - - public PluginBuilder( String groupId, String artifactId, String version ) - { - plugin = new Plugin(); - plugin.setGroupId( groupId ); - plugin.setArtifactId( artifactId ); - plugin.setVersion( version ); - } - - // Dependencies - // - public PluginBuilder addDependency( String groupId, String artifactId, String version, String scope, Exclusion exclusion ) - { - return addDependency( groupId, artifactId, version, scope, exclusion ); - } - - public PluginBuilder addDependency( String groupId, String artifactId, String version, String scope, String systemPath ) - { - return addDependency( groupId, artifactId, version, scope, systemPath, null ); - } - - public PluginBuilder addDependency( String groupId, String artifactId, String version, String scope, String systemPath, Exclusion exclusion ) - { - Dependency d = new Dependency(); - d.setGroupId( groupId ); - d.setArtifactId( artifactId ); - d.setVersion( version ); - d.setScope( scope ); - - if ( systemPath != null && scope.equals( Artifact.SCOPE_SYSTEM ) ) - { - d.setSystemPath( systemPath ); - } - - if ( exclusion != null ) - { - d.addExclusion( exclusion ); - } - - plugin.getDependencies().add( d ); - - return this; - } - - public Plugin get() - { - return plugin; - } - } } diff --git a/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java b/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java index ad9a19237334..3d8306e530de 100644 --- a/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java +++ b/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java @@ -214,28 +214,6 @@ public void testMojoThatRequiresExecutionToAGivenPhaseBeforeExecutingItself() public void testThatPluginDependencyThatHasSystemScopeIsResolved() throws Exception { - /* - File systemPath = new File( getBasedir(), "pom.xml" ); - - Plugin plugin = new PluginBuilder( "org.apache.maven", "project-test", "1.0" ) - .addDependency( "org.apache.maven", "system-dependency", "1.0", Artifact.SCOPE_SYSTEM, systemPath.getAbsolutePath() ) - .get(); - - MavenProject pluginProject = new ProjectBuilder( "org.apache.maven", "project-test", "1.0" ) - .addPlugin( plugin ) - .addDependency( "junit", "junit", "3.8.1", Artifact.SCOPE_COMPILE ) - .get(); - - // i'm making this artifact which is assumed to come from a pom in the metadata processor, then it tries to create a POM artifact - // and parse it for the dependencies and it blows up. - // - // we need to pass this through as is so it doesn't get parsed again. - Artifact pluginArtifact = new ProjectArtifact( pluginProject ); - - Set artifacts = pluginManager.getPluginArtifacts( pluginArtifact, plugin, getLocalRepository(), getPluginArtifactRepositories() ); - System.out.println( artifacts ); - */ - MavenSession session = createMavenSession( getProject( "project-contributing-system-scope-plugin-dep" ) ); MavenProject project = session.getCurrentProject(); Plugin plugin = project.getPlugin( "org.apache.maven.its.plugins:maven-it-plugin" );