mirror of https://github.com/apache/maven.git
o don't need a separate module anymore, simplified to the point where I'm back to something similar to 2.x
git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@751455 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
41df8abcf8
commit
ab3b68a650
|
@ -1,59 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
or more contributor license agreements. See the NOTICE file
|
|
||||||
distributed with this work for additional information
|
|
||||||
regarding copyright ownership. The ASF licenses this file
|
|
||||||
to you under the Apache License, Version 2.0 (the
|
|
||||||
"License"); you may not use this file except in compliance
|
|
||||||
with the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
|
||||||
software distributed under the License is distributed on an
|
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
KIND, either express or implied. See the License for the
|
|
||||||
specific language governing permissions and limitations
|
|
||||||
under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>maven</artifactId>
|
|
||||||
<groupId>org.apache.maven</groupId>
|
|
||||||
<version>3.0-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<artifactId>maven-lifecycle</artifactId>
|
|
||||||
<name>Maven Lifecycle Model</name>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
|
||||||
<artifactId>plexus-container-default</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
|
||||||
<artifactId>plexus-utils</artifactId>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.codehaus.modello</groupId>
|
|
||||||
<artifactId>modello-maven-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<models>
|
|
||||||
<model>src/main/mdo/maven-lifecycle.mdo</model>
|
|
||||||
</models>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,84 +0,0 @@
|
||||||
package org.apache.maven.lifecycle;
|
|
||||||
|
|
||||||
import org.apache.maven.lifecycle.model.LifecycleBindings;
|
|
||||||
import org.apache.maven.lifecycle.model.io.xpp3.LifecycleBindingsXpp3Reader;
|
|
||||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author jdcasey
|
|
||||||
*/
|
|
||||||
public class ClassLoaderXmlBindingLoader
|
|
||||||
implements LifecycleBindingLoader
|
|
||||||
{
|
|
||||||
|
|
||||||
// configuration.
|
|
||||||
private String path;
|
|
||||||
|
|
||||||
public ClassLoaderXmlBindingLoader()
|
|
||||||
{
|
|
||||||
// for plexus init.
|
|
||||||
}
|
|
||||||
|
|
||||||
public ClassLoaderXmlBindingLoader( String path )
|
|
||||||
{
|
|
||||||
this.path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LifecycleBindings getBindings()
|
|
||||||
throws LifecycleLoaderException, LifecycleSpecificationException
|
|
||||||
{
|
|
||||||
ClassLoader loader = Thread.currentThread().getContextClassLoader();
|
|
||||||
URL url = loader.getResource( getPath() );
|
|
||||||
|
|
||||||
if ( url == null )
|
|
||||||
{
|
|
||||||
throw new LifecycleLoaderException( "Classpath resource: " + getPath() + " could not be found." );
|
|
||||||
}
|
|
||||||
|
|
||||||
InputStreamReader reader;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
reader = new InputStreamReader( url.openStream() );
|
|
||||||
}
|
|
||||||
catch ( IOException e )
|
|
||||||
{
|
|
||||||
throw new LifecycleLoaderException( "Failed to open stream for classpath resource: " + getPath() + ". Reason: "
|
|
||||||
+ e.getMessage(), e );
|
|
||||||
}
|
|
||||||
|
|
||||||
LifecycleBindings bindings;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
bindings = new LifecycleBindingsXpp3Reader().read( reader );
|
|
||||||
}
|
|
||||||
catch ( IOException e )
|
|
||||||
{
|
|
||||||
throw new LifecycleLoaderException( "Classpath resource: " + getPath() + " could not be read. Reason: "
|
|
||||||
+ e.getMessage(), e );
|
|
||||||
}
|
|
||||||
catch ( XmlPullParserException e )
|
|
||||||
{
|
|
||||||
throw new LifecycleLoaderException( "Classpath resource: " + getPath() + " could not be parsed. Reason: "
|
|
||||||
+ e.getMessage(), e );
|
|
||||||
}
|
|
||||||
|
|
||||||
LifecycleUtils.setOrigin( bindings, url.toExternalForm() );
|
|
||||||
|
|
||||||
return bindings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPath()
|
|
||||||
{
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPath( String path )
|
|
||||||
{
|
|
||||||
this.path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
package org.apache.maven.lifecycle;
|
|
||||||
|
|
||||||
import org.apache.maven.lifecycle.model.LifecycleBindings;
|
|
||||||
|
|
||||||
public interface LifecycleBindingLoader
|
|
||||||
{
|
|
||||||
|
|
||||||
String ROLE = LifecycleBindingLoader.class.getName();
|
|
||||||
|
|
||||||
LifecycleBindings getBindings()
|
|
||||||
throws LifecycleLoaderException, LifecycleSpecificationException;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package org.apache.maven.lifecycle;
|
|
||||||
|
|
||||||
public abstract class LifecycleException
|
|
||||||
extends Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
protected LifecycleException( String message, Throwable cause )
|
|
||||||
{
|
|
||||||
super( message, cause );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected LifecycleException( String message )
|
|
||||||
{
|
|
||||||
super( message );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package org.apache.maven.lifecycle;
|
|
||||||
|
|
||||||
public class LifecycleLoaderException
|
|
||||||
extends LifecycleException
|
|
||||||
{
|
|
||||||
|
|
||||||
public LifecycleLoaderException( String message, Throwable cause )
|
|
||||||
{
|
|
||||||
super( message, cause );
|
|
||||||
}
|
|
||||||
|
|
||||||
public LifecycleLoaderException( String message )
|
|
||||||
{
|
|
||||||
super( message );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package org.apache.maven.lifecycle;
|
|
||||||
|
|
||||||
public class LifecycleSpecificationException
|
|
||||||
extends LifecycleException
|
|
||||||
{
|
|
||||||
|
|
||||||
public LifecycleSpecificationException( String message, Throwable cause )
|
|
||||||
{
|
|
||||||
super( message, cause );
|
|
||||||
}
|
|
||||||
|
|
||||||
public LifecycleSpecificationException( String message )
|
|
||||||
{
|
|
||||||
super( message );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,714 +0,0 @@
|
||||||
package org.apache.maven.lifecycle;
|
|
||||||
|
|
||||||
import org.apache.maven.lifecycle.model.BuildBinding;
|
|
||||||
import org.apache.maven.lifecycle.model.CleanBinding;
|
|
||||||
import org.apache.maven.lifecycle.model.LifecycleBinding;
|
|
||||||
import org.apache.maven.lifecycle.model.LifecycleBindings;
|
|
||||||
import org.apache.maven.lifecycle.model.MojoBinding;
|
|
||||||
import org.apache.maven.lifecycle.model.Phase;
|
|
||||||
import org.apache.maven.lifecycle.model.SiteBinding;
|
|
||||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
public class LifecycleUtils
|
|
||||||
{
|
|
||||||
|
|
||||||
private LifecycleUtils()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setupTrackingInfo( final LifecycleBindings bindings )
|
|
||||||
{
|
|
||||||
for ( Iterator bindingIt = bindings.getBindingList().iterator(); bindingIt.hasNext(); )
|
|
||||||
{
|
|
||||||
LifecycleBinding binding = (LifecycleBinding) bindingIt.next();
|
|
||||||
|
|
||||||
if ( binding == null )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
LinkedHashMap phaseMap = binding.getOrderedPhaseMapping();
|
|
||||||
for ( Iterator phaseIt = phaseMap.entrySet().iterator(); phaseIt.hasNext(); )
|
|
||||||
{
|
|
||||||
Map.Entry entry = (Entry) phaseIt.next();
|
|
||||||
Phase phase = (Phase) entry.getValue();
|
|
||||||
|
|
||||||
String phaseName = (String) entry.getKey();
|
|
||||||
|
|
||||||
if ( phase != null )
|
|
||||||
{
|
|
||||||
phase.setLifecycleInfo( phaseName, binding );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setOrigin( final LifecycleBindings bindings, final String origin )
|
|
||||||
{
|
|
||||||
for ( Iterator bindingIt = bindings.getBindingList().iterator(); bindingIt.hasNext(); )
|
|
||||||
{
|
|
||||||
LifecycleBinding binding = (LifecycleBinding) bindingIt.next();
|
|
||||||
|
|
||||||
if ( binding == null )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( Iterator phaseIt = binding.getPhasesInOrder().iterator(); phaseIt.hasNext(); )
|
|
||||||
{
|
|
||||||
Phase phase = (Phase) phaseIt.next();
|
|
||||||
|
|
||||||
if ( phase == null )
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( Iterator mojoIt = phase.getBindings().iterator(); mojoIt.hasNext(); )
|
|
||||||
{
|
|
||||||
MojoBinding mojoBinding = (MojoBinding) mojoIt.next();
|
|
||||||
|
|
||||||
mojoBinding.setOrigin( origin );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List getMojoBindingListForLifecycle( final String stopPhase, final LifecycleBindings bindings )
|
|
||||||
throws NoSuchPhaseException
|
|
||||||
{
|
|
||||||
LifecycleBinding binding = findLifecycleBindingForPhase( stopPhase, bindings );
|
|
||||||
|
|
||||||
if ( binding == null )
|
|
||||||
{
|
|
||||||
throw new NoSuchPhaseException( stopPhase, "Phase not found in any lifecycle." );
|
|
||||||
}
|
|
||||||
|
|
||||||
return getMojoBindingListForLifecycle( stopPhase, binding );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List getMojoBindingListForLifecycle( final String stopPhase, final LifecycleBinding lifecycle )
|
|
||||||
throws NoSuchPhaseException
|
|
||||||
{
|
|
||||||
List phaseNames = lifecycle.getPhaseNamesInOrder();
|
|
||||||
|
|
||||||
int idx = phaseNames.indexOf( stopPhase );
|
|
||||||
|
|
||||||
if ( idx < 0 )
|
|
||||||
{
|
|
||||||
throw new NoSuchPhaseException( stopPhase, "Phase not found in lifecycle: " + lifecycle.getId() );
|
|
||||||
}
|
|
||||||
|
|
||||||
List phases = lifecycle.getPhasesInOrder();
|
|
||||||
|
|
||||||
List bindings = new ArrayList();
|
|
||||||
for ( int i = 0; i <= idx; i++ )
|
|
||||||
{
|
|
||||||
Phase phase = (Phase) phases.get( i );
|
|
||||||
List phaseBindings = phase.getBindings();
|
|
||||||
|
|
||||||
if ( ( phaseBindings != null ) && !phaseBindings.isEmpty() )
|
|
||||||
{
|
|
||||||
bindings.addAll( phaseBindings );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return bindings;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return null if the phase is not contained in any of the lifecycles.
|
|
||||||
*/
|
|
||||||
public static LifecycleBinding findLifecycleBindingForPhase( final String phaseName,
|
|
||||||
final LifecycleBindings lifecycles )
|
|
||||||
{
|
|
||||||
List lifecyclesAvailable = lifecycles.getBindingList();
|
|
||||||
|
|
||||||
for ( Iterator it = lifecyclesAvailable.iterator(); it.hasNext(); )
|
|
||||||
{
|
|
||||||
LifecycleBinding lifecycle = (LifecycleBinding) it.next();
|
|
||||||
|
|
||||||
if ( lifecycle.getPhaseNamesInOrder().indexOf( phaseName ) > -1 )
|
|
||||||
{
|
|
||||||
return lifecycle;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeMojoBinding( final String phaseName, final MojoBinding mojoBinding,
|
|
||||||
final LifecycleBinding lifecycleBinding, final boolean considerExecutionId )
|
|
||||||
throws NoSuchPhaseException
|
|
||||||
{
|
|
||||||
List phaseNames = lifecycleBinding.getPhaseNamesInOrder();
|
|
||||||
|
|
||||||
int idx = phaseNames.indexOf( phaseName );
|
|
||||||
|
|
||||||
if ( idx < 0 )
|
|
||||||
{
|
|
||||||
throw new NoSuchPhaseException( phaseName, "Phase: " + phaseName + " not found in lifecycle: "
|
|
||||||
+ lifecycleBinding.getId() );
|
|
||||||
}
|
|
||||||
|
|
||||||
List phases = lifecycleBinding.getPhasesInOrder();
|
|
||||||
|
|
||||||
Phase phase = (Phase) phases.get( idx );
|
|
||||||
|
|
||||||
if ( phase != null )
|
|
||||||
{
|
|
||||||
List mojoBindings = phase.getBindings();
|
|
||||||
|
|
||||||
String targetKey = MojoBindingUtils.createMojoBindingKey( mojoBinding, considerExecutionId );
|
|
||||||
|
|
||||||
for ( Iterator it = mojoBindings.iterator(); it.hasNext(); )
|
|
||||||
{
|
|
||||||
MojoBinding candidate = (MojoBinding) it.next();
|
|
||||||
|
|
||||||
String candidateKey = MojoBindingUtils.createMojoBindingKey( candidate, considerExecutionId );
|
|
||||||
if ( candidateKey.equals( targetKey ) )
|
|
||||||
{
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
phase.setBindings( mojoBindings );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addMojoBinding( final String phaseName, final MojoBinding mojoBinding,
|
|
||||||
final LifecycleBinding lifecycleBinding ) throws NoSuchPhaseException
|
|
||||||
{
|
|
||||||
List phaseNames = lifecycleBinding.getPhaseNamesInOrder();
|
|
||||||
|
|
||||||
int idx = phaseNames.indexOf( phaseName );
|
|
||||||
|
|
||||||
if ( idx < 0 )
|
|
||||||
{
|
|
||||||
throw new NoSuchPhaseException( phaseName, "Phase: " + phaseName + " not found in lifecycle: "
|
|
||||||
+ lifecycleBinding.getId() );
|
|
||||||
}
|
|
||||||
|
|
||||||
List phases = lifecycleBinding.getPhasesInOrder();
|
|
||||||
|
|
||||||
Phase phase = (Phase) phases.get( idx );
|
|
||||||
phase.addBinding( mojoBinding );
|
|
||||||
mojoBinding.setLifecycleInfo( phase );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addMojoBinding( final String phaseName, final MojoBinding mojo, final LifecycleBindings bindings )
|
|
||||||
throws LifecycleSpecificationException
|
|
||||||
{
|
|
||||||
LifecycleBinding binding = findLifecycleBindingForPhase( phaseName, bindings );
|
|
||||||
|
|
||||||
if ( binding == null )
|
|
||||||
{
|
|
||||||
throw new NoSuchPhaseException( phaseName, "Phase not found in any lifecycle: " + phaseName );
|
|
||||||
}
|
|
||||||
|
|
||||||
addMojoBinding( phaseName, mojo, binding );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LifecycleBindings mergeBindings( final LifecycleBindings existingBindings,
|
|
||||||
final LifecycleBindings newBindings,
|
|
||||||
final LifecycleBindings defaultBindings,
|
|
||||||
final boolean mergeConfigIfExecutionIdMatches )
|
|
||||||
{
|
|
||||||
return mergeBindings( existingBindings, newBindings, defaultBindings, mergeConfigIfExecutionIdMatches, false );
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LifecycleBindings mergeBindings( final LifecycleBindings existingBindings,
|
|
||||||
final LifecycleBindings newBindings,
|
|
||||||
final LifecycleBindings defaultBindings,
|
|
||||||
final boolean mergeConfigIfExecutionIdMatches,
|
|
||||||
final boolean reverseConfigMergeDirection )
|
|
||||||
{
|
|
||||||
LifecycleBindings result = new LifecycleBindings();
|
|
||||||
result.setPackaging( newBindings.getPackaging() );
|
|
||||||
|
|
||||||
CleanBinding cb = (CleanBinding) cloneBinding( existingBindings.getCleanBinding() );
|
|
||||||
if ( ( defaultBindings != null ) && isNullOrEmpty( cb ) )
|
|
||||||
{
|
|
||||||
cb = (CleanBinding) cloneBinding( defaultBindings.getCleanBinding() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( cb == null )
|
|
||||||
{
|
|
||||||
cb = new CleanBinding();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.setCleanBinding( cb );
|
|
||||||
|
|
||||||
BuildBinding bb = (BuildBinding) cloneBinding( existingBindings.getBuildBinding() );
|
|
||||||
if ( ( defaultBindings != null ) && isNullOrEmpty( bb ) )
|
|
||||||
{
|
|
||||||
bb = (BuildBinding) cloneBinding( defaultBindings.getBuildBinding() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( bb == null )
|
|
||||||
{
|
|
||||||
bb = new BuildBinding();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.setBuildBinding( bb );
|
|
||||||
|
|
||||||
SiteBinding sb = (SiteBinding) cloneBinding( existingBindings.getSiteBinding() );
|
|
||||||
if ( ( defaultBindings != null ) && isNullOrEmpty( sb ) )
|
|
||||||
{
|
|
||||||
sb = (SiteBinding) cloneBinding( defaultBindings.getSiteBinding() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( sb == null )
|
|
||||||
{
|
|
||||||
sb = new SiteBinding();
|
|
||||||
}
|
|
||||||
|
|
||||||
result.setSiteBinding( sb );
|
|
||||||
|
|
||||||
for ( Iterator bindingIt = newBindings.getBindingList().iterator(); bindingIt.hasNext(); )
|
|
||||||
{
|
|
||||||
LifecycleBinding lifecycleBinding = (LifecycleBinding) bindingIt.next();
|
|
||||||
|
|
||||||
if ( lifecycleBinding != null )
|
|
||||||
{
|
|
||||||
List phaseNames = lifecycleBinding.getPhaseNamesInOrder();
|
|
||||||
List phases = lifecycleBinding.getPhasesInOrder();
|
|
||||||
|
|
||||||
for ( int i = 0; i < phases.size(); i++ )
|
|
||||||
{
|
|
||||||
Phase phase = (Phase) phases.get( i );
|
|
||||||
String name = (String) phaseNames.get( i );
|
|
||||||
|
|
||||||
if ( ( phase != null ) && ( phase.getBindings() != null ) && !phase.getBindings().isEmpty() )
|
|
||||||
{
|
|
||||||
for ( Iterator phaseIt = phase.getBindings().iterator(); phaseIt.hasNext(); )
|
|
||||||
{
|
|
||||||
MojoBinding mojoBinding = (MojoBinding) phaseIt.next();
|
|
||||||
|
|
||||||
mojoBinding = cloneMojoBinding( mojoBinding );
|
|
||||||
|
|
||||||
if ( mergeConfigIfExecutionIdMatches )
|
|
||||||
{
|
|
||||||
MojoBinding matchingBinding =
|
|
||||||
findMatchingMojoBinding( mojoBinding, existingBindings, true );
|
|
||||||
|
|
||||||
if ( matchingBinding != null )
|
|
||||||
{
|
|
||||||
Xpp3Dom existingConfig = new Xpp3Dom( (Xpp3Dom) matchingBinding.getConfiguration() );
|
|
||||||
|
|
||||||
Xpp3Dom configuration;
|
|
||||||
if ( reverseConfigMergeDirection )
|
|
||||||
{
|
|
||||||
configuration =
|
|
||||||
Xpp3Dom.mergeXpp3Dom( existingConfig,
|
|
||||||
(Xpp3Dom) mojoBinding.getConfiguration() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
configuration =
|
|
||||||
Xpp3Dom.mergeXpp3Dom( (Xpp3Dom) mojoBinding.getConfiguration(),
|
|
||||||
existingConfig );
|
|
||||||
}
|
|
||||||
|
|
||||||
mojoBinding.setConfiguration( configuration );
|
|
||||||
|
|
||||||
if ( ( mojoBinding.getOrigin() == null ) && ( matchingBinding.getOrigin() != null ) )
|
|
||||||
{
|
|
||||||
mojoBinding.setOrigin( matchingBinding.getOrigin() );
|
|
||||||
}
|
|
||||||
|
|
||||||
LifecycleBinding resultBinding = findLifecycleBindingForPhase( name, result );
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
removeMojoBinding( name, matchingBinding, resultBinding, true );
|
|
||||||
}
|
|
||||||
catch ( NoSuchPhaseException e )
|
|
||||||
{
|
|
||||||
IllegalStateException error =
|
|
||||||
new IllegalStateException(
|
|
||||||
e.getMessage()
|
|
||||||
+ "\nSomething strange is going on. Merging should not encounter such inconsistencies." );
|
|
||||||
|
|
||||||
error.initCause( e );
|
|
||||||
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
addMojoBinding( name, mojoBinding, result );
|
|
||||||
}
|
|
||||||
catch ( LifecycleSpecificationException e )
|
|
||||||
{
|
|
||||||
// NOTE: this shouldn't happen as long as normal components are used
|
|
||||||
// to create/read these LifecycleBindings instances.
|
|
||||||
IllegalArgumentException error =
|
|
||||||
new IllegalArgumentException( "Project bindings are invalid. Reason: "
|
|
||||||
+ e.getMessage() );
|
|
||||||
|
|
||||||
error.initCause( e );
|
|
||||||
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isNullOrEmpty( final LifecycleBinding binding )
|
|
||||||
{
|
|
||||||
if ( binding == null )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( Iterator it = binding.getPhasesInOrder().iterator(); it.hasNext(); )
|
|
||||||
{
|
|
||||||
Phase phase = (Phase) it.next();
|
|
||||||
|
|
||||||
if ( !phase.getBindings().isEmpty() )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MojoBinding findMatchingMojoBinding( final MojoBinding mojoBinding,
|
|
||||||
final LifecycleBindings inBindings,
|
|
||||||
final boolean considerExecutionId )
|
|
||||||
{
|
|
||||||
String key = MojoBindingUtils.createMojoBindingKey( mojoBinding, considerExecutionId );
|
|
||||||
|
|
||||||
return (MojoBinding) mapMojoBindingsByKey( inBindings, considerExecutionId ).get( key );
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Map mapMojoBindingsByKey( final LifecycleBindings bindings, final boolean considerExecutionId )
|
|
||||||
{
|
|
||||||
Map byKey = new HashMap();
|
|
||||||
|
|
||||||
for ( Iterator bindingIt = bindings.getBindingList().iterator(); bindingIt.hasNext(); )
|
|
||||||
{
|
|
||||||
LifecycleBinding binding = (LifecycleBinding) bindingIt.next();
|
|
||||||
|
|
||||||
if ( binding != null )
|
|
||||||
{
|
|
||||||
for ( Iterator phaseIt = binding.getPhasesInOrder().iterator(); phaseIt.hasNext(); )
|
|
||||||
{
|
|
||||||
Phase phase = (Phase) phaseIt.next();
|
|
||||||
|
|
||||||
if ( phase != null )
|
|
||||||
{
|
|
||||||
for ( Iterator mojoIt = phase.getBindings().iterator(); mojoIt.hasNext(); )
|
|
||||||
{
|
|
||||||
MojoBinding mojoBinding = (MojoBinding) mojoIt.next();
|
|
||||||
|
|
||||||
byKey.put( MojoBindingUtils.createMojoBindingKey( mojoBinding, considerExecutionId ),
|
|
||||||
mojoBinding );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return byKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeMojoBindings( final List toRemove, final LifecycleBindings bindings,
|
|
||||||
final boolean considerExecutionId ) throws NoSuchPhaseException
|
|
||||||
{
|
|
||||||
if ( bindings.getCleanBinding() != null )
|
|
||||||
{
|
|
||||||
removeMojoBindings( toRemove, bindings.getCleanBinding(), considerExecutionId );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( bindings.getBuildBinding() != null )
|
|
||||||
{
|
|
||||||
removeMojoBindings( toRemove, bindings.getBuildBinding(), considerExecutionId );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( bindings.getSiteBinding() != null )
|
|
||||||
{
|
|
||||||
removeMojoBindings( toRemove, bindings.getSiteBinding(), considerExecutionId );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void removeMojoBindings( final List toRemove, final LifecycleBinding removeFrom,
|
|
||||||
final boolean considerExecutionId ) throws NoSuchPhaseException
|
|
||||||
{
|
|
||||||
// remove where gid:aid:goal matches.
|
|
||||||
List targets = new ArrayList();
|
|
||||||
for ( Iterator it = toRemove.iterator(); it.hasNext(); )
|
|
||||||
{
|
|
||||||
MojoBinding binding = (MojoBinding) it.next();
|
|
||||||
|
|
||||||
targets.add( MojoBindingUtils.createMojoBindingKey( binding, considerExecutionId ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
List phases = removeFrom.getPhasesInOrder();
|
|
||||||
|
|
||||||
for ( int i = 0; i < phases.size(); i++ )
|
|
||||||
{
|
|
||||||
Phase phase = (Phase) phases.get( i );
|
|
||||||
List phaseBindings = phase.getBindings();
|
|
||||||
|
|
||||||
for ( Iterator mojoIt = phaseBindings.iterator(); mojoIt.hasNext(); )
|
|
||||||
{
|
|
||||||
MojoBinding binding = (MojoBinding) mojoIt.next();
|
|
||||||
String key = MojoBindingUtils.createMojoBindingKey( binding, considerExecutionId );
|
|
||||||
if ( targets.contains( key ) )
|
|
||||||
{
|
|
||||||
mojoIt.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
phase.setBindings( phaseBindings );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LifecycleBindings cloneBindings( final LifecycleBindings bindings )
|
|
||||||
{
|
|
||||||
LifecycleBindings result = new LifecycleBindings();
|
|
||||||
|
|
||||||
if ( bindings.getCleanBinding() != null )
|
|
||||||
{
|
|
||||||
result.setCleanBinding( (CleanBinding) cloneBinding( bindings.getCleanBinding() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( bindings.getBuildBinding() != null )
|
|
||||||
{
|
|
||||||
result.setBuildBinding( (BuildBinding) cloneBinding( bindings.getBuildBinding() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( bindings.getSiteBinding() != null )
|
|
||||||
{
|
|
||||||
result.setSiteBinding( (SiteBinding) cloneBinding( bindings.getSiteBinding() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static LifecycleBinding cloneBinding( final LifecycleBinding binding )
|
|
||||||
{
|
|
||||||
if ( binding == null )
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
LifecycleBinding result;
|
|
||||||
if ( binding instanceof CleanBinding )
|
|
||||||
{
|
|
||||||
result = new CleanBinding();
|
|
||||||
}
|
|
||||||
else if ( binding instanceof SiteBinding )
|
|
||||||
{
|
|
||||||
result = new SiteBinding();
|
|
||||||
}
|
|
||||||
else if ( binding instanceof BuildBinding )
|
|
||||||
{
|
|
||||||
result = new BuildBinding();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new IllegalArgumentException( "Unrecognized LifecycleBinding type: " + binding.getClass().getName()
|
|
||||||
+ "; cannot clone." );
|
|
||||||
}
|
|
||||||
|
|
||||||
List phases = binding.getPhasesInOrder();
|
|
||||||
List names = binding.getPhaseNamesInOrder();
|
|
||||||
|
|
||||||
for ( int i = 0; i < phases.size(); i++ )
|
|
||||||
{
|
|
||||||
Phase phase = (Phase) phases.get( i );
|
|
||||||
String phaseName = (String) names.get( i );
|
|
||||||
|
|
||||||
for ( Iterator mojoIt = phase.getBindings().iterator(); mojoIt.hasNext(); )
|
|
||||||
{
|
|
||||||
MojoBinding originalBinding = (MojoBinding) mojoIt.next();
|
|
||||||
|
|
||||||
MojoBinding newBinding = cloneMojoBinding( originalBinding );
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
addMojoBinding( phaseName, newBinding, result );
|
|
||||||
}
|
|
||||||
catch ( NoSuchPhaseException e )
|
|
||||||
{
|
|
||||||
IllegalStateException error =
|
|
||||||
new IllegalStateException(
|
|
||||||
e.getMessage()
|
|
||||||
+ "\nSomething strange is going on. Cloning should not encounter such inconsistencies." );
|
|
||||||
|
|
||||||
error.initCause( e );
|
|
||||||
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MojoBinding cloneMojoBinding( final MojoBinding binding )
|
|
||||||
{
|
|
||||||
MojoBinding result = new MojoBinding();
|
|
||||||
|
|
||||||
result.setGroupId( binding.getGroupId() );
|
|
||||||
result.setArtifactId( binding.getArtifactId() );
|
|
||||||
result.setVersion( binding.getVersion() );
|
|
||||||
result.setConfiguration( binding.getConfiguration() );
|
|
||||||
result.setExecutionId( binding.getExecutionId() );
|
|
||||||
result.setGoal( binding.getGoal() );
|
|
||||||
result.setOrigin( binding.getOrigin() );
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Phase findPhaseForMojoBinding( final MojoBinding mojoBinding,
|
|
||||||
final LifecycleBindings lifecycleBindings,
|
|
||||||
final boolean considerExecutionId )
|
|
||||||
{
|
|
||||||
String targetKey = MojoBindingUtils.createMojoBindingKey( mojoBinding, considerExecutionId );
|
|
||||||
|
|
||||||
for ( Iterator lifecycleIt = lifecycleBindings.getBindingList().iterator(); lifecycleIt.hasNext(); )
|
|
||||||
{
|
|
||||||
LifecycleBinding binding = (LifecycleBinding) lifecycleIt.next();
|
|
||||||
|
|
||||||
for ( Iterator phaseIt = binding.getPhasesInOrder().iterator(); phaseIt.hasNext(); )
|
|
||||||
{
|
|
||||||
Phase phase = (Phase) phaseIt.next();
|
|
||||||
|
|
||||||
for ( Iterator mojoIt = phase.getBindings().iterator(); mojoIt.hasNext(); )
|
|
||||||
{
|
|
||||||
MojoBinding candidate = (MojoBinding) mojoIt.next();
|
|
||||||
String key = MojoBindingUtils.createMojoBindingKey( candidate, considerExecutionId );
|
|
||||||
if ( key.equals( targetKey ) )
|
|
||||||
{
|
|
||||||
return phase;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isMojoBindingPresent( final MojoBinding binding, final List candidates,
|
|
||||||
final boolean considerExecutionId )
|
|
||||||
{
|
|
||||||
String key = MojoBindingUtils.createMojoBindingKey( binding, considerExecutionId );
|
|
||||||
|
|
||||||
for ( Iterator it = candidates.iterator(); it.hasNext(); )
|
|
||||||
{
|
|
||||||
MojoBinding candidate = (MojoBinding) it.next();
|
|
||||||
|
|
||||||
String candidateKey = MojoBindingUtils.createMojoBindingKey( candidate, considerExecutionId );
|
|
||||||
|
|
||||||
if ( candidateKey.equals( key ) )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isValidPhaseName( final String phaseName )
|
|
||||||
{
|
|
||||||
LifecycleBindings test = new LifecycleBindings();
|
|
||||||
for ( Iterator it = test.getBindingList().iterator(); it.hasNext(); )
|
|
||||||
{
|
|
||||||
LifecycleBinding binding = (LifecycleBinding) it.next();
|
|
||||||
|
|
||||||
if ( binding.getPhaseNamesInOrder().contains( phaseName ) )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List getValidPhaseNames()
|
|
||||||
{
|
|
||||||
List phaseNames = new ArrayList();
|
|
||||||
|
|
||||||
LifecycleBindings bindings = new LifecycleBindings();
|
|
||||||
for ( Iterator bindingIt = bindings.getBindingList().iterator(); bindingIt.hasNext(); )
|
|
||||||
{
|
|
||||||
LifecycleBinding binding = (LifecycleBinding) bindingIt.next();
|
|
||||||
|
|
||||||
for ( Iterator phaseNameIt = binding.getPhaseNamesInOrder().iterator(); phaseNameIt.hasNext(); )
|
|
||||||
{
|
|
||||||
phaseNames.add( phaseNameIt.next() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return phaseNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List getValidBuildPhaseNames()
|
|
||||||
{
|
|
||||||
List phaseNames = new ArrayList();
|
|
||||||
|
|
||||||
LifecycleBinding binding = new BuildBinding();
|
|
||||||
|
|
||||||
for ( Iterator phaseNameIt = binding.getPhaseNamesInOrder().iterator(); phaseNameIt.hasNext(); )
|
|
||||||
{
|
|
||||||
phaseNames.add( phaseNameIt.next() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return phaseNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List getValidCleanPhaseNames()
|
|
||||||
{
|
|
||||||
List phaseNames = new ArrayList();
|
|
||||||
|
|
||||||
LifecycleBinding binding = new CleanBinding();
|
|
||||||
|
|
||||||
for ( Iterator phaseNameIt = binding.getPhaseNamesInOrder().iterator(); phaseNameIt.hasNext(); )
|
|
||||||
{
|
|
||||||
phaseNames.add( phaseNameIt.next() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return phaseNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List getValidSitePhaseNames()
|
|
||||||
{
|
|
||||||
List phaseNames = new ArrayList();
|
|
||||||
|
|
||||||
LifecycleBinding binding = new SiteBinding();
|
|
||||||
|
|
||||||
for ( Iterator phaseNameIt = binding.getPhaseNamesInOrder().iterator(); phaseNameIt.hasNext(); )
|
|
||||||
{
|
|
||||||
phaseNames.add( phaseNameIt.next() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return phaseNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link MojoBindingUtils#createMojoBindingKey(MojoBinding, boolean)} instead.
|
|
||||||
*/
|
|
||||||
public static String createMojoBindingKey( final MojoBinding mojoBinding, final boolean considerExecutionId )
|
|
||||||
{
|
|
||||||
return MojoBindingUtils.createMojoBindingKey( mojoBinding, considerExecutionId );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
package org.apache.maven.lifecycle;
|
|
||||||
|
|
||||||
import org.apache.maven.lifecycle.model.MojoBinding;
|
|
||||||
|
|
||||||
public final class MojoBindingUtils
|
|
||||||
{
|
|
||||||
|
|
||||||
private MojoBindingUtils()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String toString( final MojoBinding mojoBinding )
|
|
||||||
{
|
|
||||||
return mojoBinding.getGroupId() + ":" + mojoBinding.getArtifactId() + ":"
|
|
||||||
+ ( mojoBinding.getVersion() == null ? "" : mojoBinding.getVersion() + ":" )
|
|
||||||
+ mojoBinding.getGoal();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String createMojoBindingKey( final MojoBinding mojoBinding, final boolean considerExecutionId )
|
|
||||||
{
|
|
||||||
String key = mojoBinding.getGroupId() + ":" + mojoBinding.getArtifactId() + ":" + mojoBinding.getGoal();
|
|
||||||
|
|
||||||
if ( considerExecutionId )
|
|
||||||
{
|
|
||||||
key += ":" + mojoBinding.getExecutionId();
|
|
||||||
}
|
|
||||||
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String createPluginKey( final MojoBinding binding )
|
|
||||||
{
|
|
||||||
String result = binding.getGroupId() + ":" + binding.getArtifactId();
|
|
||||||
|
|
||||||
if ( binding.getVersion() != null )
|
|
||||||
{
|
|
||||||
result += ":" + binding.getVersion();
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
package org.apache.maven.lifecycle;
|
|
||||||
|
|
||||||
public class NoSuchLifecycleException
|
|
||||||
extends LifecycleSpecificationException
|
|
||||||
{
|
|
||||||
|
|
||||||
private final String packaging;
|
|
||||||
|
|
||||||
public NoSuchLifecycleException( String packaging, String message, Throwable cause )
|
|
||||||
{
|
|
||||||
super( message, cause );
|
|
||||||
this.packaging = packaging;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NoSuchLifecycleException( String phase, String message )
|
|
||||||
{
|
|
||||||
super( message );
|
|
||||||
this.packaging = phase;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPackaging()
|
|
||||||
{
|
|
||||||
return packaging;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
package org.apache.maven.lifecycle;
|
|
||||||
|
|
||||||
public class NoSuchPhaseException
|
|
||||||
extends LifecycleSpecificationException
|
|
||||||
{
|
|
||||||
|
|
||||||
private final String phase;
|
|
||||||
|
|
||||||
public NoSuchPhaseException( String phase, String message, Throwable cause )
|
|
||||||
{
|
|
||||||
super( message, cause );
|
|
||||||
this.phase = phase;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NoSuchPhaseException( String phase, String message )
|
|
||||||
{
|
|
||||||
super( message );
|
|
||||||
this.phase = phase;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPhase()
|
|
||||||
{
|
|
||||||
return phase;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,708 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
or more contributor license agreements. See the NOTICE file
|
|
||||||
distributed with this work for additional information
|
|
||||||
regarding copyright ownership. The ASF licenses this file
|
|
||||||
to you under the Apache License, Version 2.0 (the
|
|
||||||
"License"); you may not use this file except in compliance
|
|
||||||
with the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing,
|
|
||||||
software distributed under the License is distributed on an
|
|
||||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
||||||
KIND, either express or implied. See the License for the
|
|
||||||
specific language governing permissions and limitations
|
|
||||||
under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
*** NOTE: If you add a new lifecycle or phase, be sure to update the codeSegments! ***
|
|
||||||
-->
|
|
||||||
<model xmlns="http://modello.codehaus.org/MODELLO/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://modello.codehaus.org/MODELLO/1.0.0 http://modello.codehaus.org/xsd/modello-1.0.0.xsd"
|
|
||||||
xml.namespace="http://maven.apache.org/MAVEN_LIFECYCLE/${version}"
|
|
||||||
xml.schemaLocation="http://maven.apache.org/xsd/maven-lifecycle-${version}.xsd">
|
|
||||||
<id>build-lifecycle</id>
|
|
||||||
<name>LifecycleBindings</name>
|
|
||||||
<description>Model for lifecycle specifications starting in Maven 2.1</description>
|
|
||||||
<defaults>
|
|
||||||
<default>
|
|
||||||
<key>package</key>
|
|
||||||
<value>org.apache.maven.lifecycle.model</value>
|
|
||||||
</default>
|
|
||||||
</defaults>
|
|
||||||
<classes>
|
|
||||||
<class rootElement="true" xml.tagName="lifecycles">
|
|
||||||
<name>LifecycleBindings</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<description>Specifies phase bindings for clean, site, and default lifecycles.</description>
|
|
||||||
<fields>
|
|
||||||
<field>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<name>packaging</name>
|
|
||||||
<type>String</type>
|
|
||||||
<required>true</required>
|
|
||||||
<description>POM packaging to which this lifecycle specification applies.</description>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="clean">
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<name>cleanBinding</name>
|
|
||||||
<defaultValue>new CleanBinding()</defaultValue>
|
|
||||||
<description>The binding for the clean lifecycle</description>
|
|
||||||
<association>
|
|
||||||
<type>CleanBinding</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="build">
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<name>buildBinding</name>
|
|
||||||
<defaultValue>new BuildBinding()</defaultValue>
|
|
||||||
<description>The binding for the main build (default) lifecycle</description>
|
|
||||||
<association>
|
|
||||||
<type>BuildBinding</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="site">
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<name>siteBinding</name>
|
|
||||||
<defaultValue>new SiteBinding()</defaultValue>
|
|
||||||
<description>The binding for the site lifecycle</description>
|
|
||||||
<association>
|
|
||||||
<type>SiteBinding</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
</fields>
|
|
||||||
<codeSegments>
|
|
||||||
<codeSegment>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<code><![CDATA[
|
|
||||||
public java.util.List getBindingList()
|
|
||||||
{
|
|
||||||
java.util.List lifecycles = new java.util.ArrayList();
|
|
||||||
|
|
||||||
if ( getCleanBinding() != null )
|
|
||||||
{
|
|
||||||
lifecycles.add( getCleanBinding() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( getBuildBinding() != null )
|
|
||||||
{
|
|
||||||
lifecycles.add( getBuildBinding() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( getSiteBinding() != null )
|
|
||||||
{
|
|
||||||
lifecycles.add( getSiteBinding() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return java.util.Collections.unmodifiableList( lifecycles );
|
|
||||||
}
|
|
||||||
]]></code>
|
|
||||||
</codeSegment>
|
|
||||||
</codeSegments>
|
|
||||||
</class>
|
|
||||||
<class>
|
|
||||||
<name>LifecycleBinding</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<description>Base-class for all lifecycle bindings.</description>
|
|
||||||
<codeSegments>
|
|
||||||
<codeSegment>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<code><![CDATA[
|
|
||||||
public String getId()
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException( "Unsupported in base-class." );
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.LinkedHashMap getOrderedPhaseMapping()
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException( "Unsupported in base-class." );
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.List getPhasesInOrder()
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException( "Unsupported in base-class." );
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.List getPhaseNamesInOrder()
|
|
||||||
{
|
|
||||||
throw new UnsupportedOperationException( "Unsupported in base-class." );
|
|
||||||
}
|
|
||||||
]]></code>
|
|
||||||
</codeSegment>
|
|
||||||
</codeSegments>
|
|
||||||
</class>
|
|
||||||
<class>
|
|
||||||
<name>CleanBinding</name>
|
|
||||||
<superClass>LifecycleBinding</superClass>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<fields>
|
|
||||||
<field xml.tagName="pre-clean">
|
|
||||||
<name>preClean</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="clean">
|
|
||||||
<name>clean</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="post-clean">
|
|
||||||
<name>postClean</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
</fields>
|
|
||||||
<codeSegments>
|
|
||||||
<codeSegment>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<code><![CDATA[
|
|
||||||
public String getId()
|
|
||||||
{
|
|
||||||
return "clean";
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.LinkedHashMap getOrderedPhaseMapping()
|
|
||||||
{
|
|
||||||
java.util.LinkedHashMap phases = new java.util.LinkedHashMap();
|
|
||||||
phases.put( "pre-clean", getPreClean() );
|
|
||||||
phases.put( "clean", getClean() );
|
|
||||||
phases.put( "post-clean", getPostClean() );
|
|
||||||
|
|
||||||
return phases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.List getPhasesInOrder()
|
|
||||||
{
|
|
||||||
return new java.util.ArrayList( getOrderedPhaseMapping().values() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.List getPhaseNamesInOrder()
|
|
||||||
{
|
|
||||||
return new java.util.ArrayList( getOrderedPhaseMapping().keySet() );
|
|
||||||
}
|
|
||||||
]]></code>
|
|
||||||
</codeSegment>
|
|
||||||
</codeSegments>
|
|
||||||
</class>
|
|
||||||
<class>
|
|
||||||
<name>BuildBinding</name>
|
|
||||||
<superClass>LifecycleBinding</superClass>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<fields>
|
|
||||||
<field>
|
|
||||||
<name>validate</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field>
|
|
||||||
<name>initialize</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="generate-sources">
|
|
||||||
<name>generateSources</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="process-sources">
|
|
||||||
<name>processSources</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="generate-resources">
|
|
||||||
<name>generateResources</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="process-resources">
|
|
||||||
<name>processResources</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field>
|
|
||||||
<name>compile</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="process-classes">
|
|
||||||
<name>processClasses</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="generate-test-sources">
|
|
||||||
<name>generateTestSources</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="process-test-sources">
|
|
||||||
<name>processTestSources</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="generate-test-resources">
|
|
||||||
<name>generateTestResources</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="process-test-resources">
|
|
||||||
<name>processTestResources</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="test-compile">
|
|
||||||
<name>testCompile</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="process-test-classes">
|
|
||||||
<name>processTestClasses</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="test">
|
|
||||||
<name>test</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="prepare-package">
|
|
||||||
<name>preparePackage</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="package">
|
|
||||||
<name>createPackage</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="pre-integration-test">
|
|
||||||
<name>preIntegrationTest</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="integration-test">
|
|
||||||
<name>integrationTest</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="post-integration-test">
|
|
||||||
<name>postIntegrationTest</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field>
|
|
||||||
<name>verify</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field>
|
|
||||||
<name>install</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field>
|
|
||||||
<name>deploy</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
</fields>
|
|
||||||
<codeSegments>
|
|
||||||
<codeSegment>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<code><![CDATA[
|
|
||||||
public String getId()
|
|
||||||
{
|
|
||||||
return "build";
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.LinkedHashMap getOrderedPhaseMapping()
|
|
||||||
{
|
|
||||||
java.util.LinkedHashMap phases = new java.util.LinkedHashMap();
|
|
||||||
phases.put( "validate", getValidate() );
|
|
||||||
phases.put( "initialize", getInitialize() );
|
|
||||||
phases.put( "generate-sources", getGenerateSources() );
|
|
||||||
phases.put( "process-sources", getProcessSources() );
|
|
||||||
phases.put( "generate-resources", getGenerateResources() );
|
|
||||||
phases.put( "process-resources", getProcessResources() );
|
|
||||||
phases.put( "compile", getCompile() );
|
|
||||||
phases.put( "process-classes", getProcessClasses() );
|
|
||||||
phases.put( "generate-test-sources", getGenerateTestSources() );
|
|
||||||
phases.put( "process-test-sources", getProcessTestSources() );
|
|
||||||
phases.put( "generate-test-resources", getGenerateTestResources() );
|
|
||||||
phases.put( "process-test-resources", getProcessTestResources() );
|
|
||||||
phases.put( "test-compile", getTestCompile() );
|
|
||||||
phases.put( "process-test-classes", getProcessTestClasses() );
|
|
||||||
phases.put( "test", getTest() );
|
|
||||||
phases.put( "prepare-package", getPreparePackage() );
|
|
||||||
phases.put( "package", getCreatePackage() );
|
|
||||||
phases.put( "pre-integration-test", getPreIntegrationTest() );
|
|
||||||
phases.put( "integration-test", getIntegrationTest() );
|
|
||||||
phases.put( "post-integration-test", getPostIntegrationTest() );
|
|
||||||
phases.put( "verify", getVerify() );
|
|
||||||
phases.put( "install", getInstall() );
|
|
||||||
phases.put( "deploy", getDeploy() );
|
|
||||||
|
|
||||||
return phases;
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.List getPhasesInOrder()
|
|
||||||
{
|
|
||||||
return new java.util.ArrayList( getOrderedPhaseMapping().values() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.List getPhaseNamesInOrder()
|
|
||||||
{
|
|
||||||
return new java.util.ArrayList( getOrderedPhaseMapping().keySet() );
|
|
||||||
}
|
|
||||||
]]></code>
|
|
||||||
</codeSegment>
|
|
||||||
</codeSegments>
|
|
||||||
</class>
|
|
||||||
<class>
|
|
||||||
<name>SiteBinding</name>
|
|
||||||
<superClass>LifecycleBinding</superClass>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<fields>
|
|
||||||
<field xml.tagName="pre-site">
|
|
||||||
<name>preSite</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="site">
|
|
||||||
<name>site</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="post-site">
|
|
||||||
<name>postSite</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
<field xml.tagName="site-deploy">
|
|
||||||
<name>siteDeploy</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<defaultValue>new Phase()</defaultValue>
|
|
||||||
<association>
|
|
||||||
<type>Phase</type>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
</fields>
|
|
||||||
<codeSegments>
|
|
||||||
<codeSegment>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<code><![CDATA[
|
|
||||||
public String getId()
|
|
||||||
{
|
|
||||||
return "site";
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.LinkedHashMap getOrderedPhaseMapping()
|
|
||||||
{
|
|
||||||
java.util.LinkedHashMap map = new java.util.LinkedHashMap();
|
|
||||||
map.put( "pre-site", getPreSite() );
|
|
||||||
map.put( "site", getSite() );
|
|
||||||
map.put( "post-site", getPostSite() );
|
|
||||||
map.put( "site-deploy", getSiteDeploy() );
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.List getPhasesInOrder()
|
|
||||||
{
|
|
||||||
return new java.util.ArrayList( getOrderedPhaseMapping().values() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public java.util.List getPhaseNamesInOrder()
|
|
||||||
{
|
|
||||||
return new java.util.ArrayList( getOrderedPhaseMapping().keySet() );
|
|
||||||
}
|
|
||||||
]]></code>
|
|
||||||
</codeSegment>
|
|
||||||
</codeSegments>
|
|
||||||
</class>
|
|
||||||
<class>
|
|
||||||
<name>Phase</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<description>Contains a series of mojo bindings for a given phase of a lifecycle.</description>
|
|
||||||
<fields>
|
|
||||||
<field>
|
|
||||||
<name>bindings</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<description>Collection of mojo bindings for a phase.</description>
|
|
||||||
<association>
|
|
||||||
<type>MojoBinding</type>
|
|
||||||
<multiplicity>*</multiplicity>
|
|
||||||
</association>
|
|
||||||
</field>
|
|
||||||
</fields>
|
|
||||||
<codeSegments>
|
|
||||||
<codeSegment>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<code><![CDATA[
|
|
||||||
private String name;
|
|
||||||
private LifecycleBinding lifecycleBinding;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name of this phase.
|
|
||||||
*/
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the LifecycleBinding instance to which this Phase belongs.
|
|
||||||
*/
|
|
||||||
public LifecycleBinding getLifecycleBinding()
|
|
||||||
{
|
|
||||||
return lifecycleBinding;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the name of this phase, and the Lifecycle instance to which is belongs.
|
|
||||||
*/
|
|
||||||
public void setLifecycleInfo( String phaseName, LifecycleBinding lifecycleBinding )
|
|
||||||
{
|
|
||||||
this.name = phaseName;
|
|
||||||
this.lifecycleBinding = lifecycleBinding;
|
|
||||||
|
|
||||||
java.util.List bindings = getBindings();
|
|
||||||
if ( bindings != null )
|
|
||||||
{
|
|
||||||
for( java.util.Iterator it = bindings.iterator(); it.hasNext(); )
|
|
||||||
{
|
|
||||||
MojoBinding binding = (MojoBinding) it.next();
|
|
||||||
binding.setLifecycleInfo( this );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]]></code>
|
|
||||||
</codeSegment>
|
|
||||||
</codeSegments>
|
|
||||||
</class>
|
|
||||||
<class>
|
|
||||||
<name>MojoBinding</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<description>A binding of one mojo to one lifecycle phase, possibly including configuration.</description>
|
|
||||||
<fields>
|
|
||||||
<field>
|
|
||||||
<name>groupId</name>
|
|
||||||
<required>true</required>
|
|
||||||
<identifier>true</identifier>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<description>Plugin's groupId.</description>
|
|
||||||
<type>String</type>
|
|
||||||
</field>
|
|
||||||
<field>
|
|
||||||
<name>artifactId</name>
|
|
||||||
<required>true</required>
|
|
||||||
<identifier>true</identifier>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<description>Plugin's artifactId.</description>
|
|
||||||
<type>String</type>
|
|
||||||
</field>
|
|
||||||
<field>
|
|
||||||
<name>version</name>
|
|
||||||
<required>true</required>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<description>Plugin's version.</description>
|
|
||||||
<type>String</type>
|
|
||||||
</field>
|
|
||||||
<field>
|
|
||||||
<name>goal</name>
|
|
||||||
<required>true</required>
|
|
||||||
<identifier>true</identifier>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<description>Mojo's goal name.</description>
|
|
||||||
<type>String</type>
|
|
||||||
</field>
|
|
||||||
<field>
|
|
||||||
<name>executionId</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<identifier>true</identifier>
|
|
||||||
<defaultValue>default</defaultValue>
|
|
||||||
<description>A name for this mojo binding, for purposes of merging configurations via inheritance, etc.</description>
|
|
||||||
<type>String</type>
|
|
||||||
</field>
|
|
||||||
<field>
|
|
||||||
<name>configuration</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<description>Mojo binding's configuration.</description>
|
|
||||||
<type>DOM</type>
|
|
||||||
</field>
|
|
||||||
<field>
|
|
||||||
<name>optional</name>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<description>Marks a mojo binding as optional (not required for execution of the lifecycle).</description>
|
|
||||||
<type>boolean</type>
|
|
||||||
</field>
|
|
||||||
</fields>
|
|
||||||
<codeSegments>
|
|
||||||
<codeSegment>
|
|
||||||
<version>1.0.0</version>
|
|
||||||
<code><![CDATA[
|
|
||||||
/** origin marker for mojos referenced directly by the user or embedded-mode consumer. */
|
|
||||||
public static final String DIRECT_INVOCATION_ORIGIN = "Direct invocation";
|
|
||||||
|
|
||||||
/** origin marker for single (non-lifecycle) mojos referenced by a forked-execution annotation in another mojo. */
|
|
||||||
public static final String FORKED_DIRECT_REFERENCE_ORIGIN = "Direct forking reference";
|
|
||||||
|
|
||||||
/** origin marker for mojos bound to the lifecycle through POM configuration (not packaging defaults). */
|
|
||||||
public static final String POM_ORIGIN = "POM";
|
|
||||||
|
|
||||||
/** origin marker for mojos bound to the lifecycle by a standard (or default) lifecycle mapping. */
|
|
||||||
public static final String LIFECYCLE_MAPPING_ORIGIN = "Lifecycle mapping";
|
|
||||||
|
|
||||||
/** origin marker for mojos injected into the lifecycle by Maven, to manage lifecycle state. */
|
|
||||||
public static final String INTERNAL_ORIGIN = "Maven internal state-management";
|
|
||||||
|
|
||||||
private String origin;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the origin marker set for this MojoBinding, or null. This will give a general idea of where this
|
|
||||||
* binding came from.
|
|
||||||
*/
|
|
||||||
public String getOrigin()
|
|
||||||
{
|
|
||||||
return origin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrigin( String origin )
|
|
||||||
{
|
|
||||||
this.origin = origin;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String originDescription;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return specific information about where exactly this binding came from, if it's available.
|
|
||||||
* This might be used to record the specific forking mojo or the lifecycle
|
|
||||||
* overlay name that included this mojo, for instance.
|
|
||||||
*/
|
|
||||||
public String getOriginDescription()
|
|
||||||
{
|
|
||||||
return originDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOriginDescription( String originDescription )
|
|
||||||
{
|
|
||||||
this.originDescription = originDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Phase phase;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Phase instance to which this MojoBinding is bound. NOTE: In
|
|
||||||
* some cases, the phase name may not be known, or may not exist (as in the
|
|
||||||
* case of a direct mojo invocation from the command line or embedder).
|
|
||||||
*/
|
|
||||||
public Phase getPhase()
|
|
||||||
{
|
|
||||||
return phase;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the Phase instance to which this MojoBinding is bound.
|
|
||||||
*/
|
|
||||||
public void setLifecycleInfo( Phase phase )
|
|
||||||
{
|
|
||||||
this.phase = phase;
|
|
||||||
}
|
|
||||||
]]></code>
|
|
||||||
</codeSegment>
|
|
||||||
</codeSegments>
|
|
||||||
</class>
|
|
||||||
</classes>
|
|
||||||
</model>
|
|
|
@ -1,6 +0,0 @@
|
||||||
<project>
|
|
||||||
<body>
|
|
||||||
<menu ref="parent"/>
|
|
||||||
<menu ref="reports"/>
|
|
||||||
</body>
|
|
||||||
</project>
|
|
|
@ -1,61 +0,0 @@
|
||||||
package org.apache.maven.lifecycle;
|
|
||||||
|
|
||||||
import org.apache.maven.lifecycle.model.CleanBinding;
|
|
||||||
import org.apache.maven.lifecycle.model.LifecycleBindings;
|
|
||||||
import org.apache.maven.lifecycle.model.MojoBinding;
|
|
||||||
import org.apache.maven.lifecycle.model.Phase;
|
|
||||||
import org.codehaus.plexus.PlexusTestCase;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ClassLoaderXmlBindingLoaderTest
|
|
||||||
extends PlexusTestCase
|
|
||||||
{
|
|
||||||
|
|
||||||
public void testBeanAccess_ParseSingleCleanBinding()
|
|
||||||
throws LifecycleLoaderException, LifecycleSpecificationException
|
|
||||||
{
|
|
||||||
LifecycleBindings bindings = new ClassLoaderXmlBindingLoader( "single-clean-mapping.xml" ).getBindings();
|
|
||||||
|
|
||||||
CleanBinding cleanBinding = bindings.getCleanBinding();
|
|
||||||
assertNotNull( cleanBinding );
|
|
||||||
|
|
||||||
Phase preClean = cleanBinding.getPreClean();
|
|
||||||
assertNotNull( preClean );
|
|
||||||
|
|
||||||
List mojos = preClean.getBindings();
|
|
||||||
assertNotNull( mojos );
|
|
||||||
assertEquals( 1, mojos.size() );
|
|
||||||
|
|
||||||
MojoBinding mojo = (MojoBinding) mojos.get( 0 );
|
|
||||||
assertEquals( "group", mojo.getGroupId() );
|
|
||||||
assertEquals( "artifact", mojo.getArtifactId() );
|
|
||||||
assertNull( mojo.getVersion() );
|
|
||||||
assertEquals( "goalOne", mojo.getGoal() );
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testComponentAccess_ParseSingleCleanBinding()
|
|
||||||
throws Exception
|
|
||||||
{
|
|
||||||
LifecycleBindingLoader loader = lookup( LifecycleBindingLoader.class, "single-clean-mapping" );
|
|
||||||
|
|
||||||
LifecycleBindings bindings = loader.getBindings();
|
|
||||||
|
|
||||||
CleanBinding cleanBinding = bindings.getCleanBinding();
|
|
||||||
assertNotNull( cleanBinding );
|
|
||||||
|
|
||||||
Phase preClean = cleanBinding.getPreClean();
|
|
||||||
assertNotNull( preClean );
|
|
||||||
|
|
||||||
List mojos = preClean.getBindings();
|
|
||||||
assertNotNull( mojos );
|
|
||||||
assertEquals( 1, mojos.size() );
|
|
||||||
|
|
||||||
MojoBinding mojo = (MojoBinding) mojos.get( 0 );
|
|
||||||
assertEquals( "group", mojo.getGroupId() );
|
|
||||||
assertEquals( "artifact", mojo.getArtifactId() );
|
|
||||||
assertNull( mojo.getVersion() );
|
|
||||||
assertEquals( "goalOne", mojo.getGoal() );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +0,0 @@
|
||||||
<component-set>
|
|
||||||
<components>
|
|
||||||
<component>
|
|
||||||
<role>org.apache.maven.lifecycle.LifecycleBindingLoader</role>
|
|
||||||
<role-hint>single-clean-mapping</role-hint>
|
|
||||||
<implementation>org.apache.maven.lifecycle.ClassLoaderXmlBindingLoader</implementation>
|
|
||||||
<configuration>
|
|
||||||
<path>single-clean-mapping.xml</path>
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
||||||
</components>
|
|
||||||
</component-set>
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
|
|
||||||
<lifecycles>
|
|
||||||
<clean>
|
|
||||||
<pre-clean>
|
|
||||||
<bindings>
|
|
||||||
<binding>
|
|
||||||
<groupId>group</groupId>
|
|
||||||
<artifactId>artifact</artifactId>
|
|
||||||
<goal>goalOne</goal>
|
|
||||||
</binding>
|
|
||||||
</bindings>
|
|
||||||
</pre-clean>
|
|
||||||
</clean>
|
|
||||||
</lifecycles>
|
|
Loading…
Reference in New Issue