maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1335069 - in /maven/plugin-tools/branches/MPLUGIN-189: maven-plugin-plugin/ maven-plugin-plugin/src/it/ maven-plugin-plugin/src/it/annotation-with-inheritance/ maven-plugin-plugin/src/it/annotation-with-inheritance/src/ maven-plugin-plugin...
Date Mon, 07 May 2012 15:39:58 GMT
Author: olamy
Date: Mon May  7 15:39:56 2012
New Revision: 1335069

URL: http://svn.apache.org/viewvc?rev=1335069&view=rev
Log:
[MPLUGIN-189] support parameter field inheritance

Added:
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/invoker.properties
  (with props)
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml
  (with props)
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/AbstractFirstMojo.java
  (with props)
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/CoreIt0014Mojo.java
  (with props)
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
  (with props)
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/SecondMojo.java
  (with props)
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy
  (with props)
Modified:
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/pom.xml
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/settings.xml
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
    maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/DefaultMojoAnnotationsScanner.java

Modified: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/pom.xml?rev=1335069&r1=1335068&r2=1335069&view=diff
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/pom.xml (original)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/pom.xml Mon May  7 15:39:56
2012
@@ -241,6 +241,15 @@
         </configuration>
       </plugin>
     </plugins>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-plugin-plugin</artifactId>
+          <version>2.9</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
   </build>
 
   <profiles>
@@ -289,7 +298,9 @@
         <pluginManagement>
           <plugins>
             <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-invoker-plugin</artifactId>
+              <version>1.6-SNAPSHOT</version>
               <configuration>
                 <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                 <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>

Added: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/invoker.properties?rev=1335069&view=auto
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/invoker.properties
(added)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/invoker.properties
Mon May  7 15:39:56 2012
@@ -0,0 +1,5 @@
+invoker.goals.1 = install
+invoker.goals.2 = org.apache.maven.its.annotation-with-inheritance:annotation-with-inheritance:1.0:it0014
+#FIXME disabled need to find a solution for the chicken and eggs issue.
+#help sources are generated @generated-sources but need descriptor which need compile phase
first for classes scanning
+#invoker.goals.3 = org.apache.maven.its.basic-java-annotations:maven-it-basic-java-annotations:1.0::help

Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml?rev=1335069&view=auto
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml
(added)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml
Mon May  7 15:39:56 2012
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.annotation-with-inheritance</groupId>
+  <artifactId>annotation-with-inheritance</artifactId>
+  <version>1.0</version>
+  <packaging>maven-plugin</packaging>
+
+  <name>Maven Integration Test :: annotation-with-inheritance</name>
+  <description>
+    Test plugin-plugin, which tests maven-plugin-tools-api and 
+    maven-plugin-tools-java. This will generate a plugin descriptor from 
+    java-based mojo sources, install the plugin, and then use it.
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.plugin-tools</groupId>
+      <artifactId>maven-plugin-annotations</artifactId>
+      <version>@project.version@</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
+        </configuration>
+        <executions>
+          <execution>
+            <id>mojo-descriptor</id>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/AbstractFirstMojo.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/AbstractFirstMojo.java?rev=1335069&view=auto
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/AbstractFirstMojo.java
(added)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/AbstractFirstMojo.java
Mon May  7 15:39:56 2012
@@ -0,0 +1,52 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+
+import java.io.File;
+
+/**
+ * Touches a test file.
+ *
+ */
+public abstract class AbstractFirstMojo
+    extends AbstractMojo
+{
+
+    /**
+     * Project directory.
+     */
+    @Parameter( defaultValue = "${basedir}", readonly = true )
+    protected File basedir;
+
+    @Parameter( expression = "${first.touchFile}", defaultValue = "${project.build.directory}/touch.txt",
+                required = true )
+    protected File touchFile;
+
+
+
+}

Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/AbstractFirstMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/AbstractFirstMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/CoreIt0014Mojo.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/CoreIt0014Mojo.java?rev=1335069&view=auto
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/CoreIt0014Mojo.java
(added)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/CoreIt0014Mojo.java
Mon May  7 15:39:56 2012
@@ -0,0 +1,66 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Touches a test file.
+ * 
+ */
+@Mojo( name = "it0014")
+public class CoreIt0014Mojo
+    extends AbstractMojo
+{
+    
+    @Parameter(expression ="${project.build.directory}", required = true)
+    private String outputDirectory;
+
+    public void execute()
+        throws MojoExecutionException
+    {
+        getLog().info( "outputDirectory = " + outputDirectory );
+
+        File f = new File( outputDirectory );
+        
+        if ( !f.exists() )
+        {
+            f.mkdirs();
+        }
+        
+        File touch = new File( f, "touch.txt" );
+        
+        try
+        {
+            touch.createNewFile();
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "Error writing verification file.", e );
+        }                
+    }
+
+}

Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/CoreIt0014Mojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/CoreIt0014Mojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java?rev=1335069&view=auto
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
(added)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
Mon May  7 15:39:56 2012
@@ -0,0 +1,59 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.Component;
+import org.apache.maven.plugins.annotations.Execute;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+
+import java.io.File;
+
+/**
+ * Touches a test file.
+ *
+ * @since 1.2
+ * @deprecated Don't use!
+ */
+@Mojo( name = "first", requiresDependencyResolution = "test", defaultPhase = LifecyclePhase.INTEGRATION_TEST
)
+@Execute( phase = LifecyclePhase.GENERATE_SOURCES, lifecycle = "cobertura" )
+public class FirstMojo
+    extends AbstractFirstMojo
+{
+
+    /**
+     * @since 0.1
+     * @deprecated As of 0.2
+     */
+    @Parameter( alias = "alias" )
+    private String aliasedParam;
+
+    @Component( role = "org.apache.maven.project.MavenProjectHelper", roleHint = "test" )
+    private Object projectHelper;
+
+    public void execute()
+        throws MojoExecutionException
+    {
+    }
+
+}

Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/SecondMojo.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/SecondMojo.java?rev=1335069&view=auto
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/SecondMojo.java
(added)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/SecondMojo.java
Mon May  7 15:39:56 2012
@@ -0,0 +1,38 @@
+package org.apache.maven.plugin.coreit;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugins.annotations.Mojo;
+
+/**
+ * Does nothing special.
+ * 
+ */
+@Mojo( name = "second",requiresDependencyCollection = "compile", threadSafe = true)
+public class SecondMojo
+    extends AbstractMojo
+{
+
+    public void execute()
+    {
+    }
+
+}

Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/SecondMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/SecondMojo.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy?rev=1335069&view=auto
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy
(added)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy
Mon May  7 15:39:56 2012
@@ -0,0 +1,78 @@
+File touchFile = new File( basedir, "target/touch.txt" )
+assert touchFile.isFile()
+
+File descriptorFile = new File( basedir, "target/classes/META-INF/maven/plugin.xml" );
+assert descriptorFile.isFile()
+
+def pluginDescriptor = new XmlParser().parse( descriptorFile );
+
+def mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "first"}[0]
+
+assert mojo.goal.text() == 'first'
+assert mojo.implementation.text() == 'org.apache.maven.plugin.coreit.FirstMojo'
+assert mojo.language.text() == 'java'
+assert mojo.description.text() == 'Touches a test file.'
+assert mojo.deprecated.text() == "Don't use!"
+assert mojo.requiresDependencyResolution.text() == 'test'
+assert mojo.requiresDependencyCollection.text() == ''
+assert mojo.requiresProject.text() == 'true'
+assert mojo.requiresOnline.text() == 'false'
+assert mojo.requiresDirectInvocation.text() == 'false'
+assert mojo.aggregator.text() == 'false'
+assert mojo.threadSafe.text() == 'false'
+assert mojo.phase.text() == 'integration-test'
+assert mojo.executePhase.text() == 'generate-sources'
+assert mojo.executeLifecycle.text() == 'cobertura'
+
+assert mojo.configuration.basedir[0].text() == ''
+assert mojo.configuration.basedir[0].'@implementation' == 'java.io.File'
+assert mojo.configuration.basedir[0].'@default-value' == '${basedir}'
+
+assert mojo.configuration.touchFile[0].text() == '${first.touchFile}'
+assert mojo.configuration.touchFile[0].'@implementation' == 'java.io.File'
+assert mojo.configuration.touchFile[0].'@default-value' == '${project.build.directory}/touch.txt'
+
+assert mojo.requirements.requirement.size() == 1
+
+assert mojo.requirements.requirement[0].role.text() == 'org.apache.maven.project.MavenProjectHelper'
+assert mojo.requirements.requirement[0].'role-hint'.text() == 'test'
+assert mojo.requirements.requirement[0].'field-name'.text() == 'projectHelper'
+
+assert mojo.parameters.parameter.size() == 3
+
+def parameter = mojo.parameters.parameter.findAll{ it.name.text() == "aliasedParam"}[0]
+
+assert parameter.name.text() == 'aliasedParam'
+assert parameter.alias.text() == 'alias'
+assert parameter.type.text() == 'java.lang.String'
+assert parameter.deprecated.text() == 'As of 0.2'
+assert parameter.required.text() == 'false'
+assert parameter.editable.text() == 'true'
+assert parameter.description.text() == ''
+
+parameter = mojo.parameters.parameter.findAll{ it.name.text() == "touchFile"}[0]
+
+assert parameter.name.text() == 'touchFile'
+assert parameter.alias.isEmpty()
+assert parameter.type.text() == 'java.io.File'
+assert parameter.deprecated.isEmpty()
+assert parameter.required.text() == 'true'
+assert parameter.editable.text() == 'true'
+assert parameter.description.text() == ''
+
+parameter = mojo.parameters.parameter.findAll{ it.name.text() == "basedir"}[0]
+
+assert parameter.name.text() == 'basedir'
+assert parameter.alias.isEmpty()
+assert parameter.type.text() == 'java.io.File'
+assert parameter.deprecated.isEmpty()
+assert parameter.required.text() == 'false'
+assert parameter.editable.text() == 'false'
+assert parameter.description.text() == 'Project directory.'
+
+mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "second"}[0]
+
+assert mojo.requiresDependencyCollection.text() == 'compile'
+assert mojo.threadSafe.text() == 'true'
+
+return true;

Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/settings.xml
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/settings.xml?rev=1335069&r1=1335068&r2=1335069&view=diff
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/settings.xml (original)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-plugin/src/it/settings.xml Mon May
 7 15:39:56 2012
@@ -20,6 +20,13 @@ under the License.
 -->
 
 <settings>
+  <!--mirrors>
+    <mirror>
+      <id>local.mirror</id>
+      <url>@localRepositoryUrl@</url>
+      <mirrorOf>central</mirrorOf>
+    </mirror>
+  </mirrors-->
   <profiles>
     <profile>
       <id>it-repo</id>

Modified: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java?rev=1335069&r1=1335068&r2=1335069&view=diff
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
(original)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
Mon May  7 15:39:56 2012
@@ -82,7 +82,8 @@ public class JavaAnnotationsMojoDescript
             mojoAnnotationsScannerRequest.setClassesDirectories(
                 Arrays.asList( new File( request.getProject().getBuild().getOutputDirectory()
) ) );
 
-            mojoAnnotationsScannerRequest.setDependencies( request.getProject().getCompileClasspathElements()
);
+            mojoAnnotationsScannerRequest.setDependencies(
+                toFiles( request.getProject().getCompileClasspathElements() ) );
 
             Map<String, MojoAnnotatedClass> mojoAnnotatedClasses =
                 mojoAnnotationsScanner.scan( mojoAnnotationsScannerRequest );
@@ -114,19 +115,22 @@ public class JavaAnnotationsMojoDescript
             JavaClass javaClass = javaClassesMap.get( entry.getKey() );
             if ( javaClass != null )
             {
-                entry.getValue().getMojo().setDescription( javaClass.getComment() );
-                DocletTag since = findInClassHierarchy( javaClass, "since" );
-                if ( since != null )
+                MojoAnnotationContent mojoAnnotationContent = entry.getValue().getMojo();
+                if ( mojoAnnotationContent != null )
                 {
-                    entry.getValue().getMojo().setSince( since.getValue() );
-                }
+                    mojoAnnotationContent.setDescription( javaClass.getComment() );
+                    DocletTag since = findInClassHierarchy( javaClass, "since" );
+                    if ( since != null )
+                    {
+                        mojoAnnotationContent.setSince( since.getValue() );
+                    }
 
-                DocletTag deprecated = findInClassHierarchy( javaClass, "deprecated" );
-                if ( deprecated != null )
-                {
-                    entry.getValue().getMojo().setDeprecated( deprecated.getValue() );
+                    DocletTag deprecated = findInClassHierarchy( javaClass, "deprecated"
);
+                    if ( deprecated != null )
+                    {
+                        mojoAnnotationContent.setDeprecated( deprecated.getValue() );
+                    }
                 }
-
                 Map<String, JavaField> fieldsMap = extractFieldParameterTags( javaClass
);
                 for ( Map.Entry<String, ParameterAnnotationContent> parameter : entry.getValue().getParameters().entrySet()
)
                 {
@@ -134,12 +138,12 @@ public class JavaAnnotationsMojoDescript
                     if ( javaField != null )
                     {
                         ParameterAnnotationContent parameterAnnotationContent = parameter.getValue();
-                        deprecated = javaField.getTagByName( "deprecated" );
+                        DocletTag deprecated = javaField.getTagByName( "deprecated" );
                         if ( deprecated != null )
                         {
                             parameterAnnotationContent.setDeprecated( deprecated.getValue()
);
                         }
-                        since = javaField.getTagByName( "since" );
+                        DocletTag since = javaField.getTagByName( "since" );
                         if ( since != null )
                         {
                             parameterAnnotationContent.setSince( since.getValue() );
@@ -154,12 +158,12 @@ public class JavaAnnotationsMojoDescript
                     if ( javaField != null )
                     {
                         ComponentAnnotationContent componentAnnotationContent = component.getValue();
-                        deprecated = javaField.getTagByName( "deprecated" );
+                        DocletTag deprecated = javaField.getTagByName( "deprecated" );
                         if ( deprecated != null )
                         {
                             componentAnnotationContent.setDeprecated( deprecated.getValue()
);
                         }
-                        since = javaField.getTagByName( "since" );
+                        DocletTag since = javaField.getTagByName( "since" );
                         if ( since != null )
                         {
                             componentAnnotationContent.setSince( since.getValue() );
@@ -332,7 +336,11 @@ public class JavaAnnotationsMojoDescript
 
             mojoDescriptor.setPhase( mojo.defaultPhase().id() );
 
-            for ( ParameterAnnotationContent parameterAnnotationContent : mojoAnnotatedClass.getParameters().values()
)
+            Map<String, ParameterAnnotationContent> parameters =
+                getParametersParentHierarchy( mojoAnnotatedClass, new HashMap<String,
ParameterAnnotationContent>(),
+                                              mojoAnnotatedClasses );
+
+            for ( ParameterAnnotationContent parameterAnnotationContent : parameters.values()
)
             {
                 org.apache.maven.plugin.descriptor.Parameter parameter =
                     new org.apache.maven.plugin.descriptor.Parameter();
@@ -367,4 +375,43 @@ public class JavaAnnotationsMojoDescript
         }
         return mojoDescriptors;
     }
+
+    protected Map<String, ParameterAnnotationContent> getParametersParentHierarchy(
+        MojoAnnotatedClass mojoAnnotatedClass, Map<String, ParameterAnnotationContent>
parameters,
+        Map<String, MojoAnnotatedClass> mojoAnnotatedClasses )
+    {
+        List<ParameterAnnotationContent> parameterAnnotationContents = new ArrayList<ParameterAnnotationContent>();
+
+        parameterAnnotationContents =
+            getParent( mojoAnnotatedClass, parameterAnnotationContents, mojoAnnotatedClasses
);
+
+        // move to parent first to build the Map
+        Collections.reverse( parameterAnnotationContents );
+
+        Map<String, ParameterAnnotationContent> map =
+            new HashMap<String, ParameterAnnotationContent>( parameterAnnotationContents.size()
);
+
+        for ( ParameterAnnotationContent parameterAnnotationContent : parameterAnnotationContents
)
+        {
+            map.put( parameterAnnotationContent.getFieldName(), parameterAnnotationContent
);
+        }
+        return map;
+    }
+
+    protected List<ParameterAnnotationContent> getParent( MojoAnnotatedClass mojoAnnotatedClass,
+                                                          List<ParameterAnnotationContent>
parameterAnnotationContents,
+                                                          Map<String, MojoAnnotatedClass>
mojoAnnotatedClasses )
+    {
+        parameterAnnotationContents.addAll( mojoAnnotatedClass.getParameters().values() );
+        String parentClassName = mojoAnnotatedClass.getParentClassName();
+        if ( parentClassName != null )
+        {
+            MojoAnnotatedClass parent = mojoAnnotatedClasses.get( parentClassName );
+            if ( parent != null )
+            {
+                return getParent( parent, parameterAnnotationContents, mojoAnnotatedClasses
);
+            }
+        }
+        return parameterAnnotationContents;
+    }
 }

Modified: maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/DefaultMojoAnnotationsScanner.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/DefaultMojoAnnotationsScanner.java?rev=1335069&r1=1335068&r2=1335069&view=diff
==============================================================================
--- maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/DefaultMojoAnnotationsScanner.java
(original)
+++ maven/plugin-tools/branches/MPLUGIN-189/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/scanner/DefaultMojoAnnotationsScanner.java
Mon May  7 15:39:56 2012
@@ -44,6 +44,8 @@ import java.io.InputStream;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
 
 /**
  * @author Olivier Lamy
@@ -61,6 +63,21 @@ public class DefaultMojoAnnotationsScann
         Map<String, MojoAnnotatedClass> mojoAnnotatedClasses = new HashMap<String,
MojoAnnotatedClass>();
         try
         {
+
+            //TODO scan dependencies to get super class annotations if exist request.getDependencies()
+            /*for ( File dependency : request.getDependencies() )
+            {
+                if ( dependency.isDirectory() )
+                {
+                    mojoAnnotatedClasses.putAll( scanDirectory( dependency, request.getIncludePatterns()
) );
+                }
+                else
+                {
+                    mojoAnnotatedClasses.putAll( scanFile( dependency, request.getIncludePatterns()
) );
+                }
+
+            }*/
+
             for ( File classDirectory : request.getClassesDirectories() )
             {
                 if ( classDirectory.exists() && classDirectory.isDirectory() )
@@ -69,8 +86,6 @@ public class DefaultMojoAnnotationsScann
                 }
             }
 
-            //TODO scan dependencies to get super class annotations if exist request.getDependencies()
-
             return mojoAnnotatedClasses;
         }
         catch ( IOException e )
@@ -79,6 +94,43 @@ public class DefaultMojoAnnotationsScann
         }
     }
 
+    protected Map<String, MojoAnnotatedClass> scanFile( File archiveFile, List<String>
includePatterns )
+        throws IOException, ExtractionException
+    {
+        Map<String, MojoAnnotatedClass> mojoAnnotatedClasses = new HashMap<String,
MojoAnnotatedClass>();
+        ZipInputStream archiveStream = new ZipInputStream( new FileInputStream( archiveFile
) );
+
+        try
+        {
+            for ( ZipEntry zipEntry = archiveStream.getNextEntry(); zipEntry != null;
+                  zipEntry = archiveStream.getNextEntry() )
+            {
+                if ( zipEntry.getName().endsWith( ".class" ) )
+                {
+                    MojoClassVisitor mojoClassVisitor = new MojoClassVisitor( getLogger()
);
+
+                    ClassReader rdr = new ClassReader( archiveStream );
+                    rdr.accept( mojoClassVisitor,
+                                ClassReader.SKIP_FRAMES | ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG
);
+                    analyzeVisitors( mojoClassVisitor );
+                    if ( isMojoAnnnotatedClassCandidate( mojoClassVisitor.getMojoAnnotatedClass()
) != null )
+                    {
+                        getLogger().debug(
+                            "found MojoAnnotatedClass:" + mojoClassVisitor.getMojoAnnotatedClass().getClassName()
+ ":"
+                                + mojoClassVisitor.getMojoAnnotatedClass() );
+                        mojoAnnotatedClasses.put( mojoClassVisitor.getMojoAnnotatedClass().getClassName(),
+                                                  mojoClassVisitor.getMojoAnnotatedClass()
);
+                    }
+                }
+            }
+        }
+        finally
+        {
+            IOUtil.close( archiveStream );
+        }
+        return mojoAnnotatedClasses;
+    }
+
     protected Map<String, MojoAnnotatedClass> scanDirectory( File classDirectory, List<String>
includePatterns )
         throws IOException, ExtractionException
     {
@@ -108,6 +160,9 @@ public class DefaultMojoAnnotationsScann
                     analyzeVisitors( mojoClassVisitor );
                     if ( isMojoAnnnotatedClassCandidate( mojoClassVisitor.getMojoAnnotatedClass()
) != null )
                     {
+                        getLogger().debug(
+                            "found MojoAnnotatedClass:" + mojoClassVisitor.getMojoAnnotatedClass().getClassName()
+ ":"
+                                + mojoClassVisitor.getMojoAnnotatedClass() );
                         mojoAnnotatedClasses.put( mojoClassVisitor.getMojoAnnotatedClass().getClassName(),
                                                   mojoClassVisitor.getMojoAnnotatedClass()
);
                     }



Mime
View raw message