generate components.xml rather than writing it manually

git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1337657 13f79535-47bb-0310-9956-ffa450edef68
master
Olivier Lamy 2012-05-12 21:13:24 +00:00
parent ca84ee10df
commit b6e4781de6
5 changed files with 47 additions and 37 deletions

View File

@ -57,6 +57,18 @@
<groupId>org.codehaus.plexus</groupId> <groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId> <artifactId>plexus-utils</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>org.codehaus.plexus</groupId> <groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId> <artifactId>plexus-container-default</artifactId>
@ -108,6 +120,10 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>

View File

@ -49,6 +49,7 @@ import org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor;
import org.codehaus.plexus.archiver.UnArchiver; import org.codehaus.plexus.archiver.UnArchiver;
import org.codehaus.plexus.archiver.manager.ArchiverManager; import org.codehaus.plexus.archiver.manager.ArchiverManager;
import org.codehaus.plexus.archiver.manager.NoSuchArchiverException; import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.logging.AbstractLogEnabled; import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.StringUtils;
@ -69,29 +70,22 @@ import java.util.TreeSet;
* @author Olivier Lamy * @author Olivier Lamy
* @since 3.0 * @since 3.0
*/ */
@Component(role = MojoDescriptorExtractor.class, hint = "java-annotations")
public class JavaAnnotationsMojoDescriptorExtractor public class JavaAnnotationsMojoDescriptorExtractor
extends AbstractLogEnabled extends AbstractLogEnabled
implements MojoDescriptorExtractor implements MojoDescriptorExtractor
{ {
/** @org.codehaus.plexus.component.annotations.Requirement
* @requirement
*/
private MojoAnnotationsScanner mojoAnnotationsScanner; private MojoAnnotationsScanner mojoAnnotationsScanner;
/** @org.codehaus.plexus.component.annotations.Requirement
* @requirement
*/
private ArtifactResolver artifactResolver; private ArtifactResolver artifactResolver;
/** @org.codehaus.plexus.component.annotations.Requirement
* @requirement
*/
private ArtifactFactory artifactFactory; private ArtifactFactory artifactFactory;
/** @org.codehaus.plexus.component.annotations.Requirement
* @requirement
*/
private ArchiverManager archiverManager; private ArchiverManager archiverManager;
public List<MojoDescriptor> execute( MavenProject project, PluginDescriptor pluginDescriptor ) public List<MojoDescriptor> execute( MavenProject project, PluginDescriptor pluginDescriptor )

View File

@ -55,6 +55,7 @@ import java.util.zip.ZipInputStream;
* @author Olivier Lamy * @author Olivier Lamy
* @since 3.0 * @since 3.0
*/ */
@org.codehaus.plexus.component.annotations.Component( role = MojoAnnotationsScanner.class )
public class DefaultMojoAnnotationsScanner public class DefaultMojoAnnotationsScanner
extends AbstractLogEnabled extends AbstractLogEnabled
implements MojoAnnotationsScanner implements MojoAnnotationsScanner

View File

@ -26,31 +26,6 @@
| descriptors from java classes with annotations. | descriptors from java classes with annotations.
| |
--> -->
<component>
<role>org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor</role>
<role-hint>java-annotations</role-hint>
<implementation>org.apache.maven.tools.plugin.annotations.JavaAnnotationsMojoDescriptorExtractor</implementation>
<requirements>
<requirement>
<role>org.apache.maven.tools.plugin.annotations.scanner.MojoAnnotationsScanner</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
</requirement>
<requirement>
<role>org.apache.maven.artifact.factory.ArtifactFactory</role>
</requirement>
<requirement>
<role>org.codehaus.plexus.archiver.manager.ArchiverManager</role>
</requirement>
</requirements>
</component>
<component>
<role>org.apache.maven.tools.plugin.annotations.scanner.MojoAnnotationsScanner</role>
<role-hint>default</role-hint>
<implementation>org.apache.maven.tools.plugin.annotations.scanner.DefaultMojoAnnotationsScanner</implementation>
</component>
</components> </components>
</component-set> </component-set>

24
pom.xml
View File

@ -223,6 +223,17 @@
<artifactId>plexus-utils</artifactId> <artifactId>plexus-utils</artifactId>
<version>3.0</version> <version>3.0</version>
</dependency> </dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
<version>1.5.5</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>org.codehaus.plexus</groupId> <groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId> <artifactId>plexus-container-default</artifactId>
@ -308,6 +319,19 @@
<tagBase>https://svn.apache.org/repos/asf/maven/plugin-tools/tags</tagBase> <tagBase>https://svn.apache.org/repos/asf/maven/plugin-tools/tags</tagBase>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
<version>1.5.5</version>
<executions>
<execution>
<goals>
<goal>generate-metadata</goal>
<goal>generate-test-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>