commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1495040 - in /commons/proper/commons-javadocfix-plugin/trunk: ./ src/main/java/org/apache/commons/plugins/javadocfix/
Date Thu, 20 Jun 2013 15:02:00 GMT
Author: sebb
Date: Thu Jun 20 15:02:00 2013
New Revision: 1495040

URL: http://svn.apache.org/r1495040
Log:
Add our own HelpMojo
Correct some help

Added:
    commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/HelpMojo.java
  (with props)
Modified:
    commons/proper/commons-javadocfix-plugin/trunk/pom.xml
    commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/CheckMojo.java
    commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/FixMojo.java

Modified: commons/proper/commons-javadocfix-plugin/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/commons-javadocfix-plugin/trunk/pom.xml?rev=1495040&r1=1495039&r2=1495040&view=diff
==============================================================================
--- commons/proper/commons-javadocfix-plugin/trunk/pom.xml (original)
+++ commons/proper/commons-javadocfix-plugin/trunk/pom.xml Thu Jun 20 15:02:00 2013
@@ -49,13 +49,12 @@ This is intended as a temporary measure 
   </properties>
 
   <dependencies>
-  <!-- 
+    <!-- for our own help Mojo -->
     <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-core</artifactId>
-      <version>${mavenVersion}</version>
+      <groupId>org.apache.maven.plugins</groupId>
+      <artifactId>maven-help-plugin</artifactId>
+      <version>2.2</version>
     </dependency>
-     -->
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-plugin-api</artifactId>
@@ -157,7 +156,7 @@ This is intended as a temporary measure 
               <goal>descriptor</goal>
             </goals>
           </execution>
-          <!-- Does not add much value compared with the class size. 
+          <!-- We now use our own HelpMojo 
           <execution>
             <id>generated-helpmojo</id>
             <goals>

Modified: commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/CheckMojo.java
URL: http://svn.apache.org/viewvc/commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/CheckMojo.java?rev=1495040&r1=1495039&r2=1495040&view=diff
==============================================================================
--- commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/CheckMojo.java
(original)
+++ commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/CheckMojo.java
Thu Jun 20 15:02:00 2013
@@ -23,7 +23,7 @@ import org.apache.maven.plugin.MojoFailu
 import org.apache.maven.plugins.annotations.Mojo;
 
 /**
- * Runs the JavadocFixTool on the specified directories in check mode (-C)
+ * Runs the JavadocFixTool on the specified directory trees in check mode (-R -C)
  */
 @Mojo (name = "check")
 public class CheckMojo extends AbstractJavadocFixToolMojo {

Modified: commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/FixMojo.java
URL: http://svn.apache.org/viewvc/commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/FixMojo.java?rev=1495040&r1=1495039&r2=1495040&view=diff
==============================================================================
--- commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/FixMojo.java
(original)
+++ commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/FixMojo.java
Thu Jun 20 15:02:00 2013
@@ -23,7 +23,7 @@ import org.apache.maven.plugin.MojoFailu
 import org.apache.maven.plugins.annotations.Mojo;
 
 /**
- * Runs the JavadocFixTool on the specified directories in fix mode
+ * Runs the JavadocFixTool on the specified directory trees in fix mode (-R)
  */
 @Mojo (name = "fix")
 public class FixMojo extends AbstractJavadocFixToolMojo {

Added: commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/HelpMojo.java
URL: http://svn.apache.org/viewvc/commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/HelpMojo.java?rev=1495040&view=auto
==============================================================================
--- commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/HelpMojo.java
(added)
+++ commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/HelpMojo.java
Thu Jun 20 15:02:00 2013
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ * 
+ */
+
+package org.apache.commons.plugins.javadocfix;
+
+import java.lang.reflect.Field;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.help.DescribeMojo;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Help Mojo that extends the standard Maven help plugin describe goal.
+ * This is needed because the generated help mojo 
+ * does not handle annotation property names at present.
+ */
+@Mojo (name = "help")
+public class HelpMojo extends DescribeMojo {
+
+    @Component
+    private MavenProject myProject; // Must not use same name as DescribeMojo
+
+   /**
+     * @throws MojoExecutionException  
+     * @throws MojoFailureException 
+     */
+    @Override
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        Field f = null;
+        boolean isAccessible = true; // assume accessible
+        try {
+            // Unfortunately the plugin field is private
+            f = DescribeMojo.class.getDeclaredField("plugin");
+            isAccessible = f.isAccessible();
+            if (!isAccessible) {
+                f.setAccessible(true);
+            }
+            String plugin = myProject.getGroupId() + ":" + myProject.getArtifactId();
+            f.set(this, plugin);
+            super.execute();        
+        } catch (Exception e) {
+            throw new MojoExecutionException("Could not set up plugin details");
+        } finally {
+            if (f != null && !isAccessible) {
+                f.setAccessible(isAccessible); // reset accessibility (prob not needed)
+            }
+        }
+    }
+}

Propchange: commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/HelpMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/commons-javadocfix-plugin/trunk/src/main/java/org/apache/commons/plugins/javadocfix/HelpMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision



Mime
View raw message