o Updated API to detect unknown/bad packagings

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@800315 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-08-03 11:41:33 +00:00
parent ce6a726a03
commit a52a5e8623
3 changed files with 17 additions and 9 deletions

View File

@ -1025,17 +1025,19 @@ public class DefaultLifecycleExecutor
//
public Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging )
{
LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging );
if ( lifecycleMappingForPackaging == null )
{
return null;
}
Map<Plugin, Plugin> plugins = new LinkedHashMap<Plugin, Plugin>();
for ( Lifecycle lifecycle : lifecycles )
{
LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging );
org.apache.maven.lifecycle.mapping.Lifecycle lifecycleConfiguration = null;
if ( lifecycleMappingForPackaging != null )
{
lifecycleConfiguration = lifecycleMappingForPackaging.getLifecycles().get( lifecycle.getId() );
}
org.apache.maven.lifecycle.mapping.Lifecycle lifecycleConfiguration =
lifecycleMappingForPackaging.getLifecycles().get( lifecycle.getId() );
if ( lifecycleConfiguration != null )
{

View File

@ -63,6 +63,10 @@ public interface LifecycleExecutor
// We need to know the specific version so that we can lookup the right version of the plugin descriptor
// which tells us what the default configuration is.
//
/**
* @return The plugins bound to the lifecycles of the specified packaging or {@code null} if the packaging is
* unknown.
*/
Set<Plugin> getPluginsBoundByDefaultToAllLifecycles( String packaging );
// Given a set of {@link org.apache.maven.Plugin} objects where the GAV is set we can lookup the plugin

View File

@ -57,7 +57,9 @@ public class DefaultLifecycleBindingsInjector
Collection<Plugin> defaultPlugins = lifecycle.getPluginsBoundByDefaultToAllLifecycles( packaging );
if ( !defaultPlugins.isEmpty() )
// TODO: A bad packaging is a model error, we need to report this as such!
if ( defaultPlugins != null && !defaultPlugins.isEmpty() )
{
Model lifecycleModel = new Model();
lifecycleModel.setBuild( new Build() );