You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2008/02/25 14:15:13 UTC

svn commit: r630836 - in /maven/plugin-tools/trunk/maven-plugin-plugin/src: main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java site/apt/examples/generate-descriptor.apt

Author: vsiveton
Date: Mon Feb 25 05:15:10 2008
New Revision: 630836

URL: http://svn.apache.org/viewvc?rev=630836&view=rev
Log:
MPLUGIN-45: Plugin dependencies are not put in generated plugin.xml

o honor the code in AbstractGeneratorMojo#execute(), i.e. project.getRuntimeDependencies()
o improved doc

Modified:
    maven/plugin-tools/trunk/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java
    maven/plugin-tools/trunk/maven-plugin-plugin/src/site/apt/examples/generate-descriptor.apt

Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java?rev=630836&r1=630835&r2=630836&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/DescriptorGeneratorMojo.java Mon Feb 25 05:15:10 2008
@@ -33,6 +33,7 @@
  * @version $Id$
  * @goal descriptor
  * @phase generate-resources
+ * @requiresDependencyResolution runtime
  */
 public class DescriptorGeneratorMojo
     extends AbstractGeneratorMojo

Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/site/apt/examples/generate-descriptor.apt
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/site/apt/examples/generate-descriptor.apt?rev=630836&r1=630835&r2=630836&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/site/apt/examples/generate-descriptor.apt (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/site/apt/examples/generate-descriptor.apt Mon Feb 25 05:15:10 2008
@@ -3,7 +3,7 @@
  ------
  Maria Odea Ching
  ------
- July 2006
+ February 2008
  ------
 
 ~~ Licensed to the Apache Software Foundation (ASF) under one
@@ -50,3 +50,65 @@
  The <<<goalPrefix>>> parameter will set the goal prefix for the plugin that is specified in the descriptor. The <<<outputDirectory>>>
  parameter, on the other hand, specifies the target location of the generated plugin descriptor.
 
+* Example
+
+  For instance, if we make reference on <<<MyMojo>>> from <<<maven-my-plugin>>> which is generated by the
+  Maven Archetype Plugin, i.e.:
+
+-----
+mvn archetype:create \
+  -DgroupId=org.apache.maven.plugin.my \
+  -DartifactId=maven-my-plugin \
+  -DarchetypeArtifactId=maven-archetype-mojo
+-----
+
+  The generated plugin descriptor generated by <<<mvn package>>> should be:
+
+-----
+<plugin>
+  <description></description>
+  <groupId>org.apache.maven.plugin.my</groupId>
+  <artifactId>maven-my-plugin</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <goalPrefix>my</goalPrefix>
+  <isolatedRealm>false</isolatedRealm>
+  <inheritedByDefault>true</inheritedByDefault>
+  <mojos>
+    <mojo>
+      <goal>touch</goal>
+      <description>Goal which touches a timestamp file.</description>
+      <requiresDirectInvocation>false</requiresDirectInvocation>
+      <requiresProject>true</requiresProject>
+      <requiresReports>false</requiresReports>
+      <aggregator>false</aggregator>
+      <requiresOnline>false</requiresOnline>
+      <inheritedByDefault>true</inheritedByDefault>
+      <phase>process-sources</phase>
+      <implementation>org.apache.maven.plugin.my.MyMojo</implementation>
+      <language>java</language>
+      <instantiationStrategy>per-lookup</instantiationStrategy>
+      <executionStrategy>once-per-session</executionStrategy>
+      <parameters>
+        <parameter>
+          <name>outputDirectory</name>
+          <type>java.io.File</type>
+          <required>true</required>
+          <editable>true</editable>
+          <description>Location of the file.</description>
+        </parameter>
+      </parameters>
+      <configuration>
+        <outputDirectory implementation="java.io.File">${project.build.directory}</outputDirectory>
+      </configuration>
+    </mojo>
+  </mojos>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <type>jar</type>
+      <version>2.0</version>
+    </dependency>
+  </dependencies>
+</plugin>
+-----
\ No newline at end of file