PR: MNG-225

use both groupId and artifactId in mojo descriptor


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163937 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-04-13 11:34:09 +00:00
parent ea036c2919
commit 85cc412a5f
13 changed files with 128 additions and 111 deletions

View File

@ -16,40 +16,37 @@ package org.apache.maven.lifecycle;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.maven.MavenConstants;
import org.apache.maven.artifact.handler.ArtifactHandler; import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.artifact.resolver.ArtifactResolver; import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.execution.MavenExecutionResponse; import org.apache.maven.execution.MavenExecutionResponse;
import org.apache.maven.execution.MavenSession; import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Goal; import org.apache.maven.model.Goal;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin; import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginManagement; import org.apache.maven.model.PluginManagement;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.monitor.event.EventDispatcher; import org.apache.maven.monitor.event.EventDispatcher;
import org.apache.maven.monitor.event.MavenEvents; import org.apache.maven.monitor.event.MavenEvents;
import org.apache.maven.plugin.AbstractPlugin;
import org.apache.maven.plugin.PluginExecutionException; import org.apache.maven.plugin.PluginExecutionException;
import org.apache.maven.plugin.PluginManager; import org.apache.maven.plugin.PluginManager;
import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor; import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.DefaultMavenProjectBuilder;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder; import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.DefaultMavenProjectBuilder;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.MavenConstants;
import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.io.InputStreamReader;
import java.io.IOException;
import java.net.URL;
/** /**
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a> * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
@ -120,9 +117,9 @@ public class DefaultLifecycleExecutor
if ( artifactHandler.additionalPlugin() != null ) if ( artifactHandler.additionalPlugin() != null )
{ {
String additionalPluginGroupId = AbstractPlugin.getDefaultPluginGroupId(); String additionalPluginGroupId = PluginDescriptor.getDefaultPluginGroupId();
String additionalPluginArtifactId = AbstractPlugin.getDefaultPluginArtifactId( String additionalPluginArtifactId = PluginDescriptor.getDefaultPluginArtifactId(
artifactHandler.additionalPlugin() ); artifactHandler.additionalPlugin() );
injectHandlerPluginConfiguration( project, additionalPluginGroupId, additionalPluginArtifactId ); injectHandlerPluginConfiguration( project, additionalPluginGroupId, additionalPluginArtifactId );
@ -275,9 +272,7 @@ public class DefaultLifecycleExecutor
// TODO: Right now this maven-foo-plugin so this is a hack right now. // TODO: Right now this maven-foo-plugin so this is a hack right now.
pluginId = pluginId.substring( 6 ); pluginId = PluginDescriptor.getPluginIdFromArtifactId( pluginId );
pluginId = pluginId.substring( 0, pluginId.lastIndexOf( "-" ) );
for ( Iterator i = plugin.getGoals().iterator(); i.hasNext(); ) for ( Iterator i = plugin.getGoals().iterator(); i.hasNext(); )
{ {
@ -363,7 +358,7 @@ public class DefaultLifecycleExecutor
if ( mojoDescriptor == null ) if ( mojoDescriptor == null )
{ {
String groupId = AbstractPlugin.getDefaultPluginGroupId(); String groupId = PluginDescriptor.getDefaultPluginGroupId();
String pluginId = task; String pluginId = task;
@ -372,7 +367,7 @@ public class DefaultLifecycleExecutor
pluginId = pluginId.substring( 0, pluginId.indexOf( ":" ) ); pluginId = pluginId.substring( 0, pluginId.indexOf( ":" ) );
} }
String artifactId = AbstractPlugin.getDefaultPluginArtifactId( pluginId ); String artifactId = PluginDescriptor.getDefaultPluginArtifactId( pluginId );
injectHandlerPluginConfiguration( session.getProject(), groupId, artifactId ); injectHandlerPluginConfiguration( session.getProject(), groupId, artifactId );

View File

@ -16,7 +16,6 @@ package org.apache.maven.plugin;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.maven.artifact.resolver.filter.AndArtifactFilter;
import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.MavenMetadataSource; import org.apache.maven.artifact.MavenMetadataSource;
import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.factory.ArtifactFactory;
@ -126,12 +125,7 @@ public class DefaultPluginManager
public PluginDescriptor getPluginDescriptor( String groupId, String artifactId ) public PluginDescriptor getPluginDescriptor( String groupId, String artifactId )
{ {
return (PluginDescriptor) pluginDescriptors.get( constructPluginKey( groupId, artifactId ) ); return (PluginDescriptor) pluginDescriptors.get( PluginDescriptor.constructPluginKey( groupId, artifactId ) );
}
private static String constructPluginKey( String groupId, String artifactId )
{
return groupId + ":" + artifactId;
} }
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@ -143,14 +137,15 @@ public class DefaultPluginManager
public void processPluginDescriptor( MavenPluginDescriptor mavenPluginDescriptor ) public void processPluginDescriptor( MavenPluginDescriptor mavenPluginDescriptor )
throws CycleDetectedException throws CycleDetectedException
{ {
if ( pluginsInProcess.contains( mavenPluginDescriptor.getPluginId() ) ) PluginDescriptor pluginDescriptor = mavenPluginDescriptor.getPluginDescriptor();
String key = pluginDescriptor.getId();
if ( pluginsInProcess.contains( key ) )
{ {
return; return;
} }
pluginsInProcess.add( mavenPluginDescriptor.getPluginId() ); pluginsInProcess.add( key );
PluginDescriptor pluginDescriptor = mavenPluginDescriptor.getPluginDescriptor();
for ( Iterator it = mavenPluginDescriptor.getMavenMojoDescriptors().iterator(); it.hasNext(); ) for ( Iterator it = mavenPluginDescriptor.getMavenMojoDescriptors().iterator(); it.hasNext(); )
{ {
@ -161,7 +156,6 @@ public class DefaultPluginManager
mojoDescriptors.put( mojoDescriptor.getId(), mojoDescriptor ); mojoDescriptors.put( mojoDescriptor.getId(), mojoDescriptor );
} }
String key = constructPluginKey( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId() );
pluginDescriptors.put( key, pluginDescriptor ); pluginDescriptors.put( key, pluginDescriptor );
} }
@ -196,28 +190,16 @@ public class DefaultPluginManager
public boolean isPluginInstalled( String groupId, String artifactId ) public boolean isPluginInstalled( String groupId, String artifactId )
{ {
return pluginDescriptors.containsKey( constructPluginKey( groupId, artifactId ) ); return pluginDescriptors.containsKey( PluginDescriptor.constructPluginKey( groupId, artifactId ) );
}
private static String getPluginId( String goalName )
{
String pluginId = goalName;
if ( pluginId.indexOf( ":" ) > 0 )
{
pluginId = pluginId.substring( 0, pluginId.indexOf( ":" ) );
}
return AbstractPlugin.getDefaultPluginArtifactId( pluginId );
} }
// TODO: don't throw Exception // TODO: don't throw Exception
public void verifyPluginForGoal( String goalName, MavenSession session ) public void verifyPluginForGoal( String goalName, MavenSession session )
throws Exception throws Exception
{ {
String pluginId = getPluginId( goalName ); String pluginId = PluginDescriptor.getPluginIdFromGoal( goalName );
verifyPlugin( AbstractPlugin.getDefaultPluginGroupId(), pluginId, session ); verifyPlugin( PluginDescriptor.getDefaultPluginGroupId(), pluginId, session );
} }
// TODO: don't throw Exception // TODO: don't throw Exception
@ -397,7 +379,8 @@ public class DefaultPluginManager
} }
// TODO: can probable refactor these a little when only the new plugin technique is in place // TODO: can probable refactor these a little when only the new plugin technique is in place
Xpp3Dom dom = session.getProject().getGoalConfiguration( getPluginId( goalName ), goalId ); Xpp3Dom dom = session.getProject().getGoalConfiguration( PluginDescriptor.getPluginIdFromGoal( goalName ),
goalId );
PlexusConfiguration configuration; PlexusConfiguration configuration;
if ( dom == null ) if ( dom == null )

View File

@ -38,12 +38,6 @@ public class MavenPluginDescriptor
this.pluginDescriptor = pluginDescriptor; this.pluginDescriptor = pluginDescriptor;
} }
public String getPluginId()
{
// TODO: groupID
return pluginDescriptor.getArtifactId();
}
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// Accessors // Accessors
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@ -62,4 +56,5 @@ public class MavenPluginDescriptor
{ {
return pluginDescriptor.isIsolatedRealm(); return pluginDescriptor.isIsolatedRealm();
} }
} }

View File

@ -27,7 +27,6 @@ import org.apache.maven.model.PluginManagement;
import org.apache.maven.model.Repository; import org.apache.maven.model.Repository;
import org.apache.maven.model.Scm; import org.apache.maven.model.Scm;
import org.apache.maven.util.Xpp3DomUtils; import org.apache.maven.util.Xpp3DomUtils;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom; import org.codehaus.plexus.util.xml.Xpp3Dom;
@ -44,7 +43,6 @@ import java.util.TreeMap;
* model. * model.
*/ */
public class DefaultModelInheritanceAssembler public class DefaultModelInheritanceAssembler
extends AbstractLogEnabled
implements ModelInheritanceAssembler implements ModelInheritanceAssembler
{ {
public void assembleModelInheritance( Model child, Model parent ) public void assembleModelInheritance( Model child, Model parent )

View File

@ -86,19 +86,4 @@ public abstract class AbstractPlugin
throw new PluginExecutionException( "You must override execute() if you implement the new paradigm" ); throw new PluginExecutionException( "You must override execute() if you implement the new paradigm" );
} }
/**
* @todo remove - harcoding.
*/
public static String getDefaultPluginArtifactId( String id )
{
return "maven-" + id + "-plugin";
}
/**
* @todo remove - harcoding.
*/
public static String getDefaultPluginGroupId()
{
return "org.apache.maven.plugins";
}
} }

View File

@ -87,4 +87,59 @@ public class PluginDescriptor
{ {
return isolatedRealm; return isolatedRealm;
} }
public static String constructPluginKey( String groupId, String artifactId )
{
return groupId + ":" + artifactId;
}
public String getId()
{
return constructPluginKey( groupId, artifactId );
}
/**
* @todo remove - harcoding.
*/
public static String getPluginIdFromGoal( String goalName )
{
String pluginId = goalName;
if ( pluginId.indexOf( ":" ) > 0 )
{
pluginId = pluginId.substring( 0, pluginId.indexOf( ":" ) );
}
return getDefaultPluginArtifactId( pluginId );
}
/**
* @todo remove - harcoding.
*/
public static String getDefaultPluginArtifactId( String id )
{
return "maven-" + id + "-plugin";
}
/**
* @todo remove - harcoding.
*/
public static String getDefaultPluginGroupId()
{
return "org.apache.maven.plugins";
}
/**
* Parse maven-...-plugin.
*
* @todo remove - harcoding. What about clashes?
*/
public static String getPluginIdFromArtifactId( String artifactId )
{
int firstHyphen = artifactId.indexOf( "-" );
int lastHyphen = artifactId.lastIndexOf( "-" );
return artifactId.substring( firstHyphen + 1, lastHyphen );
}
} }

View File

@ -1,6 +1,5 @@
package org.apache.maven.plugin.descriptor; package org.apache.maven.plugin.descriptor;
import org.apache.maven.plugin.AbstractPlugin;
import org.codehaus.plexus.configuration.PlexusConfiguration; import org.codehaus.plexus.configuration.PlexusConfiguration;
import org.codehaus.plexus.configuration.PlexusConfigurationException; import org.codehaus.plexus.configuration.PlexusConfigurationException;
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration; import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
@ -24,8 +23,18 @@ public class PluginDescriptorBuilder
PluginDescriptor pluginDescriptor = new PluginDescriptor(); PluginDescriptor pluginDescriptor = new PluginDescriptor();
pluginDescriptor.setGroupId( AbstractPlugin.getDefaultPluginGroupId() ); String id = c.getChild( "id" ).getValue();
pluginDescriptor.setArtifactId( AbstractPlugin.getDefaultPluginArtifactId( c.getChild( "id" ).getValue() ) ); if ( id != null )
{
// TODO: remove. This is old style mojos (alpha-1)
pluginDescriptor.setGroupId( PluginDescriptor.getDefaultPluginGroupId() );
pluginDescriptor.setArtifactId( PluginDescriptor.getDefaultPluginArtifactId( id ) );
}
else
{
pluginDescriptor.setGroupId( c.getChild( "groupId" ).getValue() );
pluginDescriptor.setArtifactId( c.getChild( "artifactId" ).getValue() );
}
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// Components // Components

View File

@ -53,7 +53,9 @@ public class PluginDescriptorGenerator
w.startElement( "plugin" ); w.startElement( "plugin" );
element( w, "id", PluginUtils.pluginId( project ) ); element( w, "groupId", project.getGroupId() );
element( w, "artifactId", project.getArtifactId() );
element( w, "isolatedRealm", "true" ); element( w, "isolatedRealm", "true" );

View File

@ -18,6 +18,7 @@ package org.apache.maven.tools.plugin.generator.jelly;
import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.Parameter; import org.apache.maven.plugin.descriptor.Parameter;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import org.apache.maven.tools.plugin.generator.Generator; import org.apache.maven.tools.plugin.generator.Generator;
import org.apache.maven.tools.plugin.util.PluginUtils; import org.apache.maven.tools.plugin.util.PluginUtils;
@ -32,11 +33,11 @@ import java.util.Set;
/** /**
* @todo use the descriptions in the descriptor for the javadoc pushed into the * @todo use the descriptions in the descriptor for the javadoc pushed into the
* source code. * source code.
* @todo write plugin.properties (as a place holder, we don't technially need * @todo write plugin.properties (as a place holder, we don't technially need
* it) * it)
* @todo convert POM or just strip out the dependencies to create a project.xml * @todo convert POM or just strip out the dependencies to create a project.xml
* that will serve as the trigger to download dependencies. * that will serve as the trigger to download dependencies.
*/ */
public class JellyHarnessGenerator public class JellyHarnessGenerator
implements Generator implements Generator
@ -46,13 +47,14 @@ public class JellyHarnessGenerator
return pluginDescriptor.getImplementation() + "Bean"; return pluginDescriptor.getImplementation() + "Bean";
} }
public void execute( String destinationDirectory, Set mojoDescriptors, MavenProject project ) throws Exception public void execute( String destinationDirectory, Set mojoDescriptors, MavenProject project )
throws Exception
{ {
FileWriter writer = new FileWriter( new File( destinationDirectory, "plugin.jelly" ) ); FileWriter writer = new FileWriter( new File( destinationDirectory, "plugin.jelly" ) );
PrettyPrintXMLWriter w = new PrettyPrintXMLWriter( writer ); PrettyPrintXMLWriter w = new PrettyPrintXMLWriter( writer );
String pluginId = PluginUtils.pluginId( project ); String pluginId = PluginDescriptor.getPluginIdFromArtifactId( project.getArtifactId() );
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
// //
@ -133,7 +135,7 @@ public class JellyHarnessGenerator
protected void processPluginDescriptor( MojoDescriptor mojoDescriptor, XMLWriter w, MavenProject project ) protected void processPluginDescriptor( MojoDescriptor mojoDescriptor, XMLWriter w, MavenProject project )
throws Exception throws Exception
{ {
String pluginId = PluginUtils.pluginId( project ); String pluginId = PluginDescriptor.getPluginIdFromArtifactId( project.getArtifactId() );
String goalName = mojoDescriptor.getGoal(); String goalName = mojoDescriptor.getGoal();
@ -252,7 +254,8 @@ public class JellyHarnessGenerator
if ( projectIndex > 0 ) if ( projectIndex > 0 )
{ {
expression = expression.substring( 0, projectIndex ) + "pom" + expression.substring( projectIndex + 7 ); expression = expression.substring( 0, projectIndex ) + "pom" +
expression.substring( projectIndex + 7 );
} }
if ( expression.startsWith( "#" ) ) if ( expression.startsWith( "#" ) )
@ -275,8 +278,7 @@ public class JellyHarnessGenerator
return str; return str;
} }
return new StringBuffer( str.length() ).append( Character.toTitleCase( str.charAt( 0 ) ) ) return new StringBuffer( str.length() ).append( Character.toTitleCase( str.charAt( 0 ) ) ).append(
.append( str.substring( 1 ) ) str.substring( 1 ) ).toString();
.toString();
} }
} }

View File

@ -34,25 +34,6 @@ public final class PluginUtils
{ {
} }
public static String pluginId( MavenProject project )
{
// ----------------------------------------------------------------------
// We will take the id from the artifactId of the POM. The artifactId is
// always of the form maven-<pluginId>-plugin so we can extract the
// pluginId from the artifactId.
// ----------------------------------------------------------------------
String artifactId = project.getArtifactId();
int firstHyphen = artifactId.indexOf( "-" );
int lastHyphen = artifactId.lastIndexOf( "-" );
String pluginId = artifactId.substring( firstHyphen + 1, lastHyphen );
return pluginId;
}
public static String[] findSources( String basedir, String include ) public static String[] findSources( String basedir, String include )
{ {
return PluginUtils.findSources( basedir, include, null ); return PluginUtils.findSources( basedir, include, null );
@ -62,10 +43,10 @@ public final class PluginUtils
{ {
DirectoryScanner scanner = new DirectoryScanner(); DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir( basedir ); scanner.setBasedir( basedir );
scanner.setIncludes( new String[] { include } ); scanner.setIncludes( new String[]{include} );
if ( !StringUtils.isEmpty( exclude ) ) if ( !StringUtils.isEmpty( exclude ) )
{ {
scanner.setExcludes( new String[] { exclude } ); scanner.setExcludes( new String[]{exclude} );
} }
scanner.scan(); scanner.scan();
@ -73,7 +54,8 @@ public final class PluginUtils
return scanner.getIncludedFiles(); return scanner.getIncludedFiles();
} }
public static void writeDependencies( XMLWriter w, MavenProject project ) throws Exception public static void writeDependencies( XMLWriter w, MavenProject project )
throws Exception
{ {
w.startElement( "dependencies" ); w.startElement( "dependencies" );

View File

@ -1,15 +1,15 @@
package org.apache.maven.tools.plugin.util; package org.apache.maven.tools.plugin.util;
import junit.framework.TestCase;
import org.apache.maven.model.Dependency; import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model; import org.apache.maven.model.Model;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.xml.CompactXMLWriter; import org.codehaus.plexus.util.xml.CompactXMLWriter;
import org.codehaus.plexus.util.xml.XMLWriter; import org.codehaus.plexus.util.xml.XMLWriter;
import java.io.StringWriter; import java.io.StringWriter;
import junit.framework.TestCase;
/** /**
* @author jdcasey * @author jdcasey
*/ */
@ -24,12 +24,13 @@ public class PluginUtilsTest
MavenProject project = new MavenProject( model ); MavenProject project = new MavenProject( model );
String pluginId = PluginUtils.pluginId( project ); String pluginId = PluginDescriptor.getPluginIdFromArtifactId( project.getArtifactId() );
System.out.println( pluginId ); System.out.println( pluginId );
} }
public void testShouldWriteDependencies() throws Exception public void testShouldWriteDependencies()
throws Exception
{ {
Dependency dependency = new Dependency(); Dependency dependency = new Dependency();
dependency.setArtifactId( "testArtifactId" ); dependency.setArtifactId( "testArtifactId" );
@ -49,9 +50,9 @@ public class PluginUtilsTest
String output = sWriter.toString(); String output = sWriter.toString();
String pattern = "<dependencies>" + "<dependency>" + "<groupId>testGroupId</groupId>" String pattern = "<dependencies>" + "<dependency>" + "<groupId>testGroupId</groupId>" +
+ "<artifactId>testArtifactId</artifactId>" + "<type>pom</type>" + "<version>0.0.0</version>" "<artifactId>testArtifactId</artifactId>" + "<type>pom</type>" + "<version>0.0.0</version>" +
+ "</dependency>" + "</dependencies>"; "</dependency>" + "</dependencies>";
assertEquals( pattern, output ); assertEquals( pattern, output );
} }

View File

@ -22,10 +22,10 @@ import com.thoughtworks.qdox.model.JavaClass;
import com.thoughtworks.qdox.model.JavaSource; import com.thoughtworks.qdox.model.JavaSource;
import org.apache.maven.plugin.descriptor.MojoDescriptor; import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.Parameter; import org.apache.maven.plugin.descriptor.Parameter;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject; import org.apache.maven.project.MavenProject;
import org.apache.maven.tools.plugin.extractor.InvalidParameterException; import org.apache.maven.tools.plugin.extractor.InvalidParameterException;
import org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor; import org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor;
import org.apache.maven.tools.plugin.util.PluginUtils;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -121,7 +121,7 @@ public class JavaMojoDescriptorExtractor
DocletTag tag; DocletTag tag;
String pluginId = PluginUtils.pluginId( project ); String pluginId = PluginDescriptor.getPluginIdFromArtifactId( project.getArtifactId() );
mojoDescriptor.setId( pluginId ); mojoDescriptor.setId( pluginId );

View File

@ -71,6 +71,16 @@ public class Main
Model model = modelReader.read( reader ); Model model = modelReader.read( reader );
// Not doing inheritence, except for groupId and version
if ( model.getGroupId() == null )
{
model.setGroupId( model.getParent().getGroupId() );
}
if ( model.getVersion() == null )
{
model.setVersion( model.getParent().getVersion() );
}
MavenProject project = new MavenProject( model ); MavenProject project = new MavenProject( model );
project.setFile( new File( pom ) ); project.setFile( new File( pom ) );
project.addCompileSourceRoot( sourceDirectory ); project.addCompileSourceRoot( sourceDirectory );