mirror of https://github.com/apache/maven.git
[MNG-6898] Drop plexus-component-metadata plugin from maven-core (#554)
Now that Plexus XMLs (and components) are out, no need for this plugin in maven-core module anymore. Changes: * convert DefaultLifecyclePluginAnalyzer to JSR330 (last plexus component in core) * drop dependency on plexus-component-annotations (note: it is still there but only as transitive dep of plexus-shim, needed to boot up Plexus Shim in tests) * remove plexus-component-metadata plugin from build * drop unused test Plexus XML
This commit is contained in:
parent
d141957ff5
commit
af9c64f80d
|
@ -134,10 +134,6 @@ under the License.
|
|||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-interpolation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-component-annotations</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
|
@ -207,10 +203,6 @@ under the License.
|
|||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-component-metadata</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.sisu</groupId>
|
||||
<artifactId>sisu-maven-plugin</artifactId>
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.HashSet;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.maven.lifecycle.DefaultLifecycles;
|
||||
|
@ -37,12 +38,18 @@ import org.apache.maven.model.InputLocation;
|
|||
import org.apache.maven.model.InputSource;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.model.PluginExecution;
|
||||
import org.codehaus.plexus.component.annotations.Component;
|
||||
import org.codehaus.plexus.component.annotations.Requirement;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
/**
|
||||
* <strong>NOTE:</strong> This class is not part of any public api and can be changed or deleted without prior notice.
|
||||
*
|
||||
|
@ -52,24 +59,28 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
|
|||
* @author jdcasey
|
||||
* @author Kristian Rosenvold (extracted class only)
|
||||
*/
|
||||
@Component( role = LifeCyclePluginAnalyzer.class )
|
||||
@Singleton
|
||||
@Named
|
||||
public class DefaultLifecyclePluginAnalyzer
|
||||
implements LifeCyclePluginAnalyzer
|
||||
{
|
||||
public static final String DEFAULTLIFECYCLEBINDINGS_MODELID = "org.apache.maven:maven-core:"
|
||||
+ DefaultLifecyclePluginAnalyzer.class.getPackage().getImplementationVersion() + ":default-lifecycle-bindings";
|
||||
|
||||
@Requirement( role = LifecycleMapping.class )
|
||||
private Map<String, LifecycleMapping> lifecycleMappings;
|
||||
private final PlexusContainer plexusContainer;
|
||||
|
||||
@Requirement
|
||||
private DefaultLifecycles defaultLifeCycles;
|
||||
private final DefaultLifecycles defaultLifeCycles;
|
||||
|
||||
@Requirement
|
||||
private Logger logger;
|
||||
private final Logger logger;
|
||||
|
||||
public DefaultLifecyclePluginAnalyzer()
|
||||
@Inject
|
||||
public DefaultLifecyclePluginAnalyzer( final PlexusContainer plexusContainer,
|
||||
final DefaultLifecycles defaultLifeCycles,
|
||||
final Logger logger )
|
||||
{
|
||||
this.plexusContainer = requireNonNull( plexusContainer );
|
||||
this.defaultLifeCycles = requireNonNull( defaultLifeCycles );
|
||||
this.logger = requireNonNull( logger );
|
||||
}
|
||||
|
||||
// These methods deal with construction intact Plugin object that look like they come from a standard
|
||||
|
@ -82,6 +93,7 @@ public class DefaultLifecyclePluginAnalyzer
|
|||
// from the plugin.xml inside a plugin.
|
||||
//
|
||||
|
||||
@Override
|
||||
public Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging )
|
||||
{
|
||||
if ( logger.isDebugEnabled() )
|
||||
|
@ -90,7 +102,7 @@ public class DefaultLifecyclePluginAnalyzer
|
|||
+ Thread.currentThread().getContextClassLoader() );
|
||||
}
|
||||
|
||||
LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging );
|
||||
LifecycleMapping lifecycleMappingForPackaging = lookupLifecycleMapping( packaging );
|
||||
|
||||
if ( lifecycleMappingForPackaging == null )
|
||||
{
|
||||
|
@ -132,6 +144,26 @@ public class DefaultLifecyclePluginAnalyzer
|
|||
return plugins.keySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a lookup using Plexus API to make sure we can look up only "visible" (see Maven classloading) components
|
||||
* from current module and for example not extensions coming from other modules.
|
||||
*/
|
||||
private LifecycleMapping lookupLifecycleMapping( final String packaging )
|
||||
{
|
||||
try
|
||||
{
|
||||
return plexusContainer.lookup( LifecycleMapping.class, packaging );
|
||||
}
|
||||
catch ( ComponentLookupException e )
|
||||
{
|
||||
if ( e.getCause() instanceof NoSuchElementException )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
throw new RuntimeException( e );
|
||||
}
|
||||
}
|
||||
|
||||
private List<Lifecycle> getOrderedLifecycles()
|
||||
{
|
||||
// NOTE: The lifecycle order can affect implied execution ids so we better be deterministic.
|
||||
|
|
|
@ -1,107 +0,0 @@
|
|||
<component-set>
|
||||
<components>
|
||||
<component>
|
||||
<role>org.apache.maven.lifecycle.binding.LegacyLifecycleParsingTestComponent</role>
|
||||
<role-hint>default</role-hint>
|
||||
<implementation>org.apache.maven.lifecycle.binding.LegacyLifecycleParsingTestComponent</implementation>
|
||||
<configuration>
|
||||
<lifecycles>
|
||||
<lifecycle>
|
||||
<id>default</id>
|
||||
<phases>
|
||||
<phase>validate</phase>
|
||||
<phase>initialize</phase>
|
||||
<phase>generate-sources</phase>
|
||||
<phase>process-sources</phase>
|
||||
<phase>generate-resources</phase>
|
||||
<phase>process-resources</phase>
|
||||
<phase>compile</phase>
|
||||
<phase>process-classes</phase>
|
||||
<phase>generate-test-sources</phase>
|
||||
<phase>process-test-sources</phase>
|
||||
<phase>generate-test-resources</phase>
|
||||
<phase>process-test-resources</phase>
|
||||
<phase>test-compile</phase>
|
||||
<phase>process-test-classes</phase>
|
||||
<phase>test</phase>
|
||||
<phase>prepare-package</phase>
|
||||
<phase>package</phase>
|
||||
<phase>pre-integration-test</phase>
|
||||
<phase>integration-test</phase>
|
||||
<phase>post-integration-test</phase>
|
||||
<phase>verify</phase>
|
||||
<phase>install</phase>
|
||||
<phase>deploy</phase>
|
||||
</phases>
|
||||
</lifecycle>
|
||||
<lifecycle>
|
||||
<id>clean</id>
|
||||
<phases>
|
||||
<phase>pre-clean</phase>
|
||||
<phase>clean</phase>
|
||||
<phase>post-clean</phase>
|
||||
</phases>
|
||||
<default-phases>
|
||||
<clean>org.apache.maven.plugins:maven-clean-plugin:clean</clean>
|
||||
</default-phases>
|
||||
</lifecycle>
|
||||
<lifecycle>
|
||||
<id>site</id>
|
||||
<phases>
|
||||
<phase>pre-site</phase>
|
||||
<phase>site</phase>
|
||||
<phase>post-site</phase>
|
||||
<phase>site-deploy</phase>
|
||||
</phases>
|
||||
<default-phases>
|
||||
<site>org.apache.maven.plugins:maven-site-plugin:site</site>
|
||||
<site-deploy>org.apache.maven.plugins:maven-site-plugin:deploy</site-deploy>
|
||||
</default-phases>
|
||||
</lifecycle>
|
||||
</lifecycles>
|
||||
</configuration>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
|
||||
<role-hint>test-mapping</role-hint>
|
||||
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
|
||||
<configuration>
|
||||
<lifecycles>
|
||||
<lifecycle>
|
||||
<id>default</id>
|
||||
<!-- START SNIPPET: pom-lifecycle -->
|
||||
|
||||
<phases>
|
||||
<package>org.apache.maven.plugins:maven-site-plugin:attach-descriptor</package>
|
||||
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
|
||||
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
|
||||
</phases>
|
||||
<!-- END SNIPPET: pom-lifecycle -->
|
||||
</lifecycle>
|
||||
</lifecycles>
|
||||
</configuration>
|
||||
</component>
|
||||
<component>
|
||||
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
|
||||
<role-hint>test-mapping2</role-hint>
|
||||
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
|
||||
<configuration>
|
||||
<lifecycles>
|
||||
<lifecycle>
|
||||
<id>default</id>
|
||||
<!-- START SNIPPET: pom-lifecycle -->
|
||||
<phases>
|
||||
<package>
|
||||
org.apache.maven.plugins:maven-site-plugin:attach-descriptor,
|
||||
org.apache.maven.plugins:maven-clean-plugin:clean
|
||||
</package>
|
||||
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
|
||||
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
|
||||
</phases>
|
||||
<!-- END SNIPPET: pom-lifecycle -->
|
||||
</lifecycle>
|
||||
</lifecycles>
|
||||
</configuration>
|
||||
</component>
|
||||
</components>
|
||||
</component-set>
|
Loading…
Reference in New Issue