diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java index cd5bce764c..ab7b5c45de 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java @@ -151,9 +151,6 @@ public class DefaultPluginManager @Requirement private PluginManagerSupport pluginManagerSupport; - @Requirement - private PluginRepository pluginRepository; - @Requirement private Logger logger; diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginPrefixLoader.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginPrefixLoader.java index b473c724f1..3899b9c5c2 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginPrefixLoader.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginPrefixLoader.java @@ -16,8 +16,9 @@ import java.util.Set; @Component(role = PluginPrefixLoader.class) public class DefaultPluginPrefixLoader - implements PluginPrefixLoader, LogEnabled + implements PluginPrefixLoader { + @Requirement private Logger logger; @Requirement @@ -41,9 +42,7 @@ public class DefaultPluginPrefixLoader * and try to resolve based on that. * */ - public Plugin findPluginForPrefix( String prefix, - MavenProject project, - MavenSession session ) + public Plugin findPluginForPrefix( String prefix, MavenProject project, MavenSession session ) throws PluginLoaderException { Set descriptors = pluginCollector.getPluginDescriptorsForPrefix( prefix ); @@ -60,8 +59,7 @@ public class DefaultPluginPrefixLoader PluginDescriptor pd = (PluginDescriptor) it.next(); Plugin projectPlugin = (Plugin) projectPluginMap.get( pd.getPluginLookupKey() ); - if ( ( projectPlugin != null ) && ( projectPlugin.getVersion() != null ) - && projectPlugin.getVersion().equals( pd.getVersion() ) ) + if ( ( projectPlugin != null ) && ( projectPlugin.getVersion() != null ) && projectPlugin.getVersion().equals( pd.getVersion() ) ) { pluginDescriptor = pd; break; @@ -89,9 +87,7 @@ public class DefaultPluginPrefixLoader plugin = new Plugin(); plugin.setArtifactId( PluginDescriptor.getDefaultPluginArtifactId( prefix ) ); - PluginDescriptor pluginDescriptor = pluginManagerSupport.loadIsolatedPluginDescriptor( plugin, - project, - session ); + PluginDescriptor pluginDescriptor = pluginManagerSupport.loadIsolatedPluginDescriptor( plugin, project, session ); plugin = toPlugin( pluginDescriptor ); } @@ -123,9 +119,7 @@ public class DefaultPluginPrefixLoader * Look for a plugin configured in the current project that has a prefix matching the one * specified. Return the {@link PluginDescriptor} if a match is found. */ - private PluginDescriptor loadFromProjectForPrefixQuery( String prefix, - MavenProject project, - MavenSession session ) + private PluginDescriptor loadFromProjectForPrefixQuery( String prefix, MavenProject project, MavenSession session ) throws PluginLoaderException { PluginDescriptor result = null; @@ -152,15 +146,10 @@ public class DefaultPluginPrefixLoader * Look for a plugin in the pluginGroups specified in the settings.xml that has a prefix * matching the one specified. Return the {@link PluginDescriptor} if a match is found. */ - private Plugin loadFromPrefixMapper( String prefix, - MavenProject project, - MavenSession session ) + private Plugin loadFromPrefixMapper( String prefix, MavenProject project, MavenSession session ) throws PluginLoaderException { - Plugin plugin = pluginMappingManager.getByPrefix( prefix, - session.getPluginGroups(), - project.getRemoteArtifactRepositories(), - session.getLocalRepository() ); + Plugin plugin = pluginMappingManager.getByPrefix( prefix, session.getPluginGroups(), project.getRemoteArtifactRepositories(), session.getLocalRepository() ); if ( plugin != null ) { @@ -173,10 +162,4 @@ public class DefaultPluginPrefixLoader return plugin; } - - public void enableLogging( Logger logger ) - { - this.logger = logger; - } - } diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRepository.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRepository.java deleted file mode 100644 index 3c54fe1737..0000000000 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginRepository.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.apache.maven.plugin; - -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.util.xml.Xpp3DomBuilder; -import org.apache.maven.model.Plugin; -import org.apache.maven.plugin.descriptor.PluginDescriptor; -import org.apache.maven.plugin.descriptor.MojoDescriptor; -import java.util.List; -import java.io.StringReader; - -@Component( role = PluginRepository.class) -public class DefaultPluginRepository implements PluginRepository -{ - @Requirement - protected MavenPluginCollector pluginCollector; - - public Plugin findPluginById(String id, String mojoId) throws Exception - { - if(pluginCollector == null) - { - throw new IllegalArgumentException("pluginCollector: null"); - } - - if(id == null) - { - throw new IllegalArgumentException("id: null"); - } - - String[] token = id.split(":"); - if(token.length != 3) - { - throw new IllegalArgumentException("id: does not include complete id"); - } - - Plugin plugin = new Plugin(); - plugin.setGroupId(token[0]); - plugin.setArtifactId(token[1]); - plugin.setVersion(token[2]); - - PluginDescriptor descriptor = pluginCollector.getPluginDescriptor(plugin); - if(descriptor == null) - { - return null; - } - - for(MojoDescriptor mojo : (List) descriptor.getMojos()) - { - if(mojo.getId().equals(mojoId) && mojo.getMojoConfiguration() != null) - { - plugin.setConfiguration(Xpp3DomBuilder.build( new StringReader( mojo.getMojoConfiguration().toString() ) )); - } - } - - return plugin; - } -} diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginRepository.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginRepository.java deleted file mode 100644 index f13e53f8dc..0000000000 --- a/maven-core/src/main/java/org/apache/maven/plugin/PluginRepository.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.apache.maven.plugin; - -import org.apache.maven.model.Plugin; -import org.codehaus.plexus.configuration.PlexusConfigurationException; - - -public interface PluginRepository { - - Plugin findPluginById(String pluginId, String mojoId) throws Exception; -}