You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/05/06 09:03:15 UTC
svn commit: r168543 -
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin
/maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor
/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator
/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator
/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner
/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-pluggy/src/main/java/org/apache/maven/tools/plugin/pluggy
/maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin
Author: brett
Date: Fri May 6 00:03:14 2005
New Revision: 168543
URL: http://svn.apache.org/viewcvs?rev=168543&view=rev
Log:
- allow multiple versions of a plugin to operate concurrently.
- allow specification of a mojo as groupId:artifactId:version:goal
- general removal of more hard coding
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManagerException.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java
maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java
maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java
maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScannerTest.java
maven/components/trunk/maven-plugin-tools/maven-plugin-tools-pluggy/src/main/java/org/apache/maven/tools/plugin/pluggy/Main.java
maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=168543&r1=168542&r2=168543&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java Fri May 6 00:03:14 2005
@@ -41,6 +41,7 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.StringTokenizer;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
@@ -139,7 +140,7 @@
String additionalPluginArtifactId = PluginDescriptor.getDefaultPluginArtifactId(
artifactHandler.additionalPlugin() );
- injectHandlerPluginConfiguration( project, additionalPluginGroupId, additionalPluginArtifactId );
+ injectHandlerPluginConfiguration( project, additionalPluginGroupId, additionalPluginArtifactId, null );
}
}
@@ -173,7 +174,8 @@
}
}
- private void injectHandlerPluginConfiguration( MavenProject project, String groupId, String artifactId )
+ private void injectHandlerPluginConfiguration( MavenProject project, String groupId, String artifactId,
+ String version )
{
String key = Plugin.constructKey( groupId, artifactId );
Plugin plugin = (Plugin) project.getBuild().getPluginsAsMap().get( key );
@@ -183,6 +185,7 @@
plugin = new Plugin();
plugin.setGroupId( groupId );
plugin.setArtifactId( artifactId );
+ plugin.setVersion( version );
Plugin def = (Plugin) project.getPluginManagement().getPluginsAsMap().get( key );
if ( def != null )
@@ -219,17 +222,18 @@
String artifactId = plugin.getArtifactId();
+ String version = plugin.getVersion();
+
+ PluginDescriptor pluginDescriptor;
try
{
- pluginManager.verifyPlugin( groupId, artifactId, session );
+ pluginDescriptor = pluginManager.verifyPlugin( groupId, artifactId, version, session );
}
catch ( PluginManagerException e )
{
throw new LifecycleExecutionException( "Internal error in the plugin manager", e );
}
- PluginDescriptor pluginDescriptor = pluginManager.getPluginDescriptor( groupId, artifactId );
-
// ----------------------------------------------------------------------
// Look to see if the plugin configuration specifies particular mojos
// within the plugin. If this is the case then simply configure the
@@ -277,10 +281,10 @@
if ( phase == null )
{
- throw new LifecycleExecutionException(
- "Required phase '" + mojoDescriptor.getPhase() + "' not found" );
+ String message = "Required phase '" + mojoDescriptor.getPhase() + "' not found";
+ throw new LifecycleExecutionException( message );
}
- phase.getGoals().add( mojoDescriptor.getFullGoalName() );
+ phase.getGoals().add( mojoDescriptor.getId() );
}
}
}
@@ -324,38 +328,66 @@
private MojoDescriptor configureMojo( String task, MavenSession session, Map phaseMap )
throws LifecycleExecutionException, ArtifactResolutionException
{
- MojoDescriptor mojoDescriptor = pluginManager.getMojoDescriptor( task );
-
- if ( mojoDescriptor == null )
- {
- String groupId = PluginDescriptor.getDefaultPluginGroupId();
+ MojoDescriptor mojoDescriptor = getMojoDescriptor( task, session );
- String pluginId = PluginDescriptor.getPrefixFromGoal( task );
-
- String artifactId = PluginDescriptor.getDefaultPluginArtifactId( pluginId );
+ configureMojoPhaseBinding( mojoDescriptor, phaseMap, session.getSettings() );
- injectHandlerPluginConfiguration( session.getProject(), groupId, artifactId );
+ return mojoDescriptor;
+ }
- try
- {
- pluginManager.verifyPlugin( groupId, artifactId, session );
- }
- catch ( PluginManagerException e )
- {
- throw new LifecycleExecutionException( "Internal error in the plugin manager", e );
- }
+ private MojoDescriptor getMojoDescriptor( String task, MavenSession session )
+ throws ArtifactResolutionException, LifecycleExecutionException
+ {
+ String groupId = null;
+ String artifactId = null;
+ String version = null;
+ String goal = null;
+
+ StringTokenizer tok = new StringTokenizer( task, ":" );
+ int numTokens = tok.countTokens();
+ if ( numTokens == 2 )
+ {
+ // TODO: look up registered aliases in plugin manager instead
+ groupId = PluginDescriptor.getDefaultPluginGroupId();
+ artifactId = PluginDescriptor.getDefaultPluginArtifactId( tok.nextToken() );
+ goal = tok.nextToken();
+ }
+ else if ( numTokens == 4 )
+ {
+ groupId = tok.nextToken();
+ artifactId = tok.nextToken();
+ version = tok.nextToken();
+ goal = tok.nextToken();
+ }
+ else
+ {
+ String message = "Invalid task '" + task + "': you must specify a valid lifecycle phase, or" +
+ " a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal";
+ throw new LifecycleExecutionException( message );
+ }
- mojoDescriptor = pluginManager.getMojoDescriptor( task );
+ // TODO: this shouldn't be necessary all the time.
+ injectHandlerPluginConfiguration( session.getProject(), groupId, artifactId, version );
- if ( mojoDescriptor == null )
+ try
+ {
+ PluginDescriptor pluginDescriptor = pluginManager.verifyPlugin( groupId, artifactId, version, session );
+ // TODO: should be able to create a Map from this
+ for ( Iterator i = pluginDescriptor.getMojos().iterator(); i.hasNext(); )
{
- throw new LifecycleExecutionException( "Required goal not found: " + task );
+ MojoDescriptor mojoDescriptor = (MojoDescriptor) i.next();
+ if ( mojoDescriptor.getGoal().equals( goal ) )
+ {
+ return mojoDescriptor;
+ }
}
}
+ catch ( PluginManagerException e )
+ {
+ throw new LifecycleExecutionException( "Internal error in the plugin manager", e );
+ }
- configureMojoPhaseBinding( mojoDescriptor, phaseMap, session.getSettings() );
-
- return mojoDescriptor;
+ throw new LifecycleExecutionException( "Required goal not found: " + task );
}
public List getPhases()
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=168543&r1=168542&r2=168543&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Fri May 6 00:03:14 2005
@@ -56,7 +56,6 @@
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.dag.CycleDetectedException;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import java.lang.reflect.Field;
@@ -71,7 +70,6 @@
extends AbstractLogEnabled
implements PluginManager, ComponentDiscoveryListener, Initializable, Contextualizable
{
- protected Map mojoDescriptors;
protected Map pluginDescriptors;
@@ -87,30 +85,15 @@
public DefaultPluginManager()
{
- mojoDescriptors = new HashMap();
-
pluginDescriptors = new HashMap();
pluginDescriptorBuilder = new PluginDescriptorBuilder();
}
- /**
- * Mojo descriptors are looked up using their id which is of the form
- * <pluginId>: <mojoId>. So this might be archetype:create for example which
- * is the create mojo that resides in the archetype plugin.
- *
- * @param name
- * @return
- * @todo remove
- */
- public MojoDescriptor getMojoDescriptor( String name )
- {
- return (MojoDescriptor) mojoDescriptors.get( name );
- }
-
- public PluginDescriptor getPluginDescriptor( String groupId, String artifactId )
+ private PluginDescriptor getPluginDescriptor( String groupId, String artifactId, String version )
{
- return (PluginDescriptor) pluginDescriptors.get( PluginDescriptor.constructPluginKey( groupId, artifactId ) );
+ return (PluginDescriptor) pluginDescriptors.get(
+ PluginDescriptor.constructPluginKey( groupId, artifactId, version ) );
}
// ----------------------------------------------------------------------
@@ -119,28 +102,6 @@
private Set pluginsInProcess = new HashSet();
- public void processPluginDescriptor( PluginDescriptor pluginDescriptor )
- throws CycleDetectedException
- {
- String key = pluginDescriptor.getId();
-
- if ( pluginsInProcess.contains( key ) )
- {
- return;
- }
-
- pluginsInProcess.add( key );
-
- for ( Iterator it = pluginDescriptor.getMojos().iterator(); it.hasNext(); )
- {
- MojoDescriptor mojoDescriptor = (MojoDescriptor) it.next();
-
- mojoDescriptors.put( mojoDescriptor.getFullGoalName(), mojoDescriptor );
- }
-
- pluginDescriptors.put( key, pluginDescriptor );
- }
-
// ----------------------------------------------------------------------
// Mojo discovery
// ----------------------------------------------------------------------
@@ -149,20 +110,26 @@
{
ComponentSetDescriptor componentSetDescriptor = event.getComponentSetDescriptor();
- if ( !( componentSetDescriptor instanceof PluginDescriptor ) )
+ if ( componentSetDescriptor instanceof PluginDescriptor )
{
- return;
- }
+ PluginDescriptor pluginDescriptor = (PluginDescriptor) componentSetDescriptor;
- PluginDescriptor pluginDescriptor = (PluginDescriptor) componentSetDescriptor;
+ if ( pluginDescriptor.getVersion() == null )
+ {
+ // TODO: temporary - until we're done testing that version is always written
+ throw new NullPointerException(
+ "Version was null - check your plugin '" + pluginDescriptor.getId() +
+ "' was built with Maven 2.0 Alpha 2" );
+ }
- try
- {
- processPluginDescriptor( pluginDescriptor );
- }
- catch ( CycleDetectedException e )
- {
- getLogger().error( "A cycle was detected in the goal graph: ", e );
+ String key = pluginDescriptor.getId();
+
+ if ( !pluginsInProcess.contains( key ) )
+ {
+ pluginsInProcess.add( key );
+
+ pluginDescriptors.put( key, pluginDescriptor );
+ }
}
}
@@ -170,16 +137,16 @@
//
// ----------------------------------------------------------------------
- private boolean isPluginInstalled( String groupId, String artifactId )
+ private boolean isPluginInstalled( String groupId, String artifactId, String version )
{
- return pluginDescriptors.containsKey( PluginDescriptor.constructPluginKey( groupId, artifactId ) );
+ return pluginDescriptors.containsKey( PluginDescriptor.constructPluginKey( groupId, artifactId, version ) );
}
- public void verifyPlugin( String groupId, String artifactId, MavenSession session )
+ public PluginDescriptor verifyPlugin( String groupId, String artifactId, String version, MavenSession session )
throws ArtifactResolutionException, PluginManagerException
{
- // TODO: we should we support concurrent versions
- if ( !isPluginInstalled( groupId, artifactId ) )
+ // TODO: this should be possibly outside
+ if ( version == null )
{
MavenProject project = session.getProject();
@@ -212,8 +179,6 @@
}
}
- String version = null;
-
if ( pluginConfig != null )
{
if ( StringUtils.isEmpty( pluginConfig.getVersion() ) )
@@ -226,7 +191,10 @@
version = pluginConfig.getVersion();
}
}
+ }
+ if ( !isPluginInstalled( groupId, artifactId, version ) )
+ {
try
{
Artifact pluginArtifact = artifactFactory.createArtifact( groupId, artifactId, version, null,
@@ -257,6 +225,7 @@
artifactId, e );
}
}
+ return getPluginDescriptor( groupId, artifactId, version );
}
protected void addPlugin( Artifact pluginArtifact, MavenSession session )
@@ -654,7 +623,8 @@
Object value = expressionEvaluator.evaluate( expression );
- getLogger().debug( "Evaluated mojo parameter expression: \'" + expression + "\' to: " + value + " for parameter: \'" + key + "\'" );
+ getLogger().debug( "Evaluated mojo parameter expression: \'" + expression + "\' to: " + value +
+ " for parameter: \'" + key + "\'" );
// TODO: remove. If there is a default value, required should have been removed by the descriptor generator
if ( value == null && !"map-oriented".equals( goal.getComponentConfigurator() ) )
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java?rev=168543&r1=168542&r2=168543&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java Fri May 6 00:03:14 2005
@@ -33,10 +33,6 @@
void executeMojo( MavenSession session, MojoDescriptor mojoDescriptor )
throws MojoExecutionException, PluginManagerException, ArtifactResolutionException;
- MojoDescriptor getMojoDescriptor( String goalId );
-
- void verifyPlugin( String groupId, String artifactId, MavenSession session )
+ PluginDescriptor verifyPlugin( String groupId, String artifactId, String version, MavenSession session )
throws ArtifactResolutionException, PluginManagerException;
-
- PluginDescriptor getPluginDescriptor( String groupId, String artifactId );
}
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManagerException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManagerException.java?rev=168543&r1=168542&r2=168543&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManagerException.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManagerException.java Fri May 6 00:03:14 2005
@@ -27,5 +27,6 @@
{
public PluginManagerException( String message, Exception e )
{
+ super( message, e );
}
}
Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java?rev=168543&r1=168542&r2=168543&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java Fri May 6 00:03:14 2005
@@ -78,7 +78,7 @@
return expression;
}
- if (expression.equals( "reports" ) )
+ if ( expression.equals( "reports" ) )
{
String role = PluginManager.ROLE;
try
@@ -87,7 +87,8 @@
for ( Iterator it = context.getProject().getReports().getPlugins().iterator(); it.hasNext(); )
{
org.apache.maven.model.Plugin plugin = (org.apache.maven.model.Plugin) it.next();
- pluginManager.verifyPlugin( plugin.getGroupId(), plugin.getArtifactId(), context );
+ pluginManager.verifyPlugin( plugin.getGroupId(), plugin.getArtifactId(), plugin.getVersion(),
+ context );
}
}
catch ( ComponentLookupException cle )
@@ -107,7 +108,7 @@
try
{
value = context.lookupMap( role );
- for ( Iterator i = ((Map) value).keySet().iterator(); i.hasNext(); )
+ for ( Iterator i = ( (Map) value ).keySet().iterator(); i.hasNext(); )
{
String key = (String) i.next();
context.getLog().debug( key + " report is found." );
@@ -187,7 +188,7 @@
// TODO: without #, this could just be an evaluate call...
String val = (String) value;
-
+
int exprStartDelimiter = val.indexOf( "${" );
if ( exprStartDelimiter >= 0 )
Modified: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java?rev=168543&r1=168542&r2=168543&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java (original)
+++ maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java Fri May 6 00:03:14 2005
@@ -247,7 +247,12 @@
public String getRoleHint()
{
- return getFullGoalName();
+ return getId();
+ }
+
+ public String getId()
+ {
+ return getPluginDescriptor().getId() + ":" + getGoal();
}
public String getFullGoalName()
Modified: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java?rev=168543&r1=168542&r2=168543&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java (original)
+++ maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptor.java Fri May 6 00:03:14 2005
@@ -18,7 +18,6 @@
import org.codehaus.plexus.component.repository.ComponentSetDescriptor;
-import java.util.Iterator;
import java.util.List;
/**
@@ -32,6 +31,8 @@
private String artifactId;
+ private String version;
+
private List dependencies;
private boolean isolatedRealm;
@@ -47,17 +48,6 @@
return getComponents();
}
- public void setMojos( List mojos )
- throws DuplicateMojoDescriptorException
- {
- for ( Iterator it = mojos.iterator(); it.hasNext(); )
- {
- MojoDescriptor descriptor = (MojoDescriptor) it.next();
-
- addMojo( descriptor );
- }
- }
-
public void addMojo( MojoDescriptor mojoDescriptor )
throws DuplicateMojoDescriptorException
{
@@ -72,8 +62,7 @@
MojoDescriptor existing = (MojoDescriptor) mojos.get( indexOf );
- throw new DuplicateMojoDescriptorException( getGoalPrefix(), mojoDescriptor.getGoal(), existing
- .getImplementation(), mojoDescriptor.getImplementation() );
+ throw new DuplicateMojoDescriptorException( getGoalPrefix(), mojoDescriptor.getGoal(), existing.getImplementation(), mojoDescriptor.getImplementation() );
}
else
{
@@ -99,8 +88,6 @@
public void setArtifactId( String artifactId )
{
this.artifactId = artifactId;
-
- setId( artifactId );
}
// ----------------------------------------------------------------------
@@ -112,28 +99,19 @@
return isolatedRealm;
}
- public static String constructPluginKey( String groupId, String artifactId )
+ public static String constructPluginKey( String groupId, String artifactId, String version )
{
- return groupId + ":" + artifactId;
+ return groupId + ":" + artifactId + ":" + version;
}
public String getId()
{
- return constructPluginKey( groupId, artifactId );
- }
-
- /**
- * @todo remove - harcoding.
- */
- public static String getPrefixFromGoal( String goalName )
- {
- String prefix = goalName;
-
- if ( prefix.indexOf( ":" ) > 0 )
+ String id = constructPluginKey( groupId, artifactId, version );
+ if ( groupId == null || artifactId == null || version == null )
{
- prefix = prefix.substring( 0, prefix.indexOf( ":" ) );
+ throw new IllegalStateException( "Plugin descriptor ID incomplete: " + id );
}
- return prefix;
+ return id;
}
/**
@@ -155,7 +133,7 @@
/**
* Parse maven-...-plugin.
*
- * @todo remove - harcoding. What about clashes?
+ * @todo move to plugin-tools-api as a default only
*/
public static String getGoalPrefixFromArtifactId( String artifactId )
{
@@ -177,17 +155,6 @@
return "1.0-SNAPSHOT";
}
- public static String getGoalIdFromFullGoal( String goalName )
- {
- // TODO: much less of this magic is needed - make the mojoDescriptor just store the first and second part
- int index = goalName.indexOf( ':' );
- if ( index >= 0 )
- {
- return goalName.substring( index + 1 );
- }
- return null;
- }
-
public String getGoalPrefix()
{
return goalPrefix;
@@ -196,5 +163,15 @@
public void setGoalPrefix( String goalPrefix )
{
this.goalPrefix = goalPrefix;
+ }
+
+ public void setVersion( String version )
+ {
+ this.version = version;
+ }
+
+ public String getVersion()
+ {
+ return version;
}
}
Modified: maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java?rev=168543&r1=168542&r2=168543&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java (original)
+++ maven/components/trunk/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java Fri May 6 00:03:14 2005
@@ -28,6 +28,7 @@
pluginDescriptor.setGroupId( c.getChild( "groupId" ).getValue() );
pluginDescriptor.setArtifactId( c.getChild( "artifactId" ).getValue() );
+ pluginDescriptor.setVersion( c.getChild( "version" ).getValue() );
pluginDescriptor.setGoalPrefix( c.getChild( "goalPrefix" ).getValue() );
// ----------------------------------------------------------------------
Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java?rev=168543&r1=168542&r2=168543&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java Fri May 6 00:03:14 2005
@@ -66,6 +66,8 @@
element( w, "artifactId", pluginDescriptor.getArtifactId() );
+ element( w, "version", pluginDescriptor.getVersion() );
+
element( w, "goalPrefix", pluginDescriptor.getGoalPrefix() );
w.startElement( "mojos" );
Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java?rev=168543&r1=168542&r2=168543&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/generator/AbstractGeneratorTestCase.java Fri May 6 00:03:14 2005
@@ -16,6 +16,7 @@
* limitations under the License.
*/
+import junit.framework.TestCase;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.Parameter;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
@@ -25,9 +26,6 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.Set;
-
-import junit.framework.TestCase;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
@@ -71,11 +69,9 @@
mojoDescriptor.setParameters( params );
- Set descriptors = Collections.singleton( mojoDescriptor );
-
PluginDescriptor pluginDescriptor = new PluginDescriptor();
-
- pluginDescriptor.addMojo(mojoDescriptor);
+
+ pluginDescriptor.addMojo( mojoDescriptor );
pluginDescriptor.setArtifactId( "maven-unitTesting-plugin" );
pluginDescriptor.setGoalPrefix( "test" );
@@ -89,10 +85,10 @@
File tempFile = File.createTempFile( "testGenerator-outDir", ".marker.txt" ).getAbsoluteFile();
File destinationDirectory = tempFile.getParentFile();
-
+
generator.execute( destinationDirectory.getAbsolutePath(), pluginDescriptor );
-
- validate(destinationDirectory);
+
+ validate( destinationDirectory );
}
// ----------------------------------------------------------------------
@@ -124,7 +120,7 @@
//
// ----------------------------------------------------------------------
- protected void validate(File destinationDirectory)
+ protected void validate( File destinationDirectory )
throws Exception
{
// empty
Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScannerTest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScannerTest.java?rev=168543&r1=168542&r2=168543&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScannerTest.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScannerTest.java Fri May 6 00:03:14 2005
@@ -37,6 +37,9 @@
project.setFile( new File( "." ) );
PluginDescriptor pluginDescriptor = new PluginDescriptor();
+ pluginDescriptor.setGroupId( "groupId" );
+ pluginDescriptor.setArtifactId( "artifactId" );
+ pluginDescriptor.setVersion( "version" );
pluginDescriptor.setGoalPrefix( "testId" );
scanner.populatePluginDescriptor( project, pluginDescriptor );
Modified: maven/components/trunk/maven-plugin-tools/maven-plugin-tools-pluggy/src/main/java/org/apache/maven/tools/plugin/pluggy/Main.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugin-tools/maven-plugin-tools-pluggy/src/main/java/org/apache/maven/tools/plugin/pluggy/Main.java?rev=168543&r1=168542&r2=168543&view=diff
==============================================================================
--- maven/components/trunk/maven-plugin-tools/maven-plugin-tools-pluggy/src/main/java/org/apache/maven/tools/plugin/pluggy/Main.java (original)
+++ maven/components/trunk/maven-plugin-tools/maven-plugin-tools-pluggy/src/main/java/org/apache/maven/tools/plugin/pluggy/Main.java Fri May 6 00:03:14 2005
@@ -87,16 +87,18 @@
Collections.singletonMap( "java", new JavaMojoDescriptorExtractor() ) );
PluginDescriptor pluginDescriptor = new PluginDescriptor();
-
- pluginDescriptor.setGroupId(project.getGroupId());
-
- pluginDescriptor.setArtifactId(project.getArtifactId());
-
+
+ pluginDescriptor.setGroupId( project.getGroupId() );
+
+ pluginDescriptor.setArtifactId( project.getArtifactId() );
+
+ pluginDescriptor.setVersion( project.getVersion() );
+
// TODO: should read this from the pom...
pluginDescriptor.setGoalPrefix( PluginDescriptor.getGoalPrefixFromArtifactId( project.getArtifactId() ) );
-
+
pluginDescriptor.setDependencies( PluginUtils.toComponentDependencies( project.getDependencies() ) );
-
+
scanner.populatePluginDescriptor( project, pluginDescriptor );
// Create the generator.
Modified: maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java?rev=168543&r1=168542&r2=168543&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java Fri May 6 00:03:14 2005
@@ -74,7 +74,9 @@
pluginDescriptor.setGroupId( project.getGroupId() );
pluginDescriptor.setArtifactId( project.getArtifactId() );
-
+
+ pluginDescriptor.setVersion( project.getVersion() );
+
pluginDescriptor.setGoalPrefix( goalPrefix );
try
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org