You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2012/05/12 18:14:41 UTC

svn commit: r1337586 - in /maven/plugin-tools/trunk: maven-plugin-annotations/ maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/ maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/ maven-pl...

Author: hboutemy
Date: Sat May 12 16:14:40 2012
New Revision: 1337586

URL: http://svn.apache.org/viewvc?rev=1337586&view=rev
Log:
added DependencyScope enumeration

Added:
    maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/DependencyScope.java   (with props)
Modified:
    maven/plugin-tools/trunk/maven-plugin-annotations/pom.xml
    maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Mojo.java
    maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
    maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/MojoAnnotationContent.java
    maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/site/apt/index.apt

Modified: maven/plugin-tools/trunk/maven-plugin-annotations/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-annotations/pom.xml?rev=1337586&r1=1337585&r2=1337586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-annotations/pom.xml (original)
+++ maven/plugin-tools/trunk/maven-plugin-annotations/pom.xml Sat May 12 16:14:40 2012
@@ -31,4 +31,11 @@
   <name>Maven Plugin Java 5 Annotations</name>
   <description>Java 5 annotations to use in Mojos.</description>
 
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>3.0</version>
+    </dependency>
+  </dependencies>
 </project>

Added: maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/DependencyScope.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/DependencyScope.java?rev=1337586&view=auto
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/DependencyScope.java (added)
+++ maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/DependencyScope.java Sat May 12 16:14:40 2012
@@ -0,0 +1,46 @@
+package org.apache.maven.plugins.annotations;
+
+/*
+ * 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.artifact.Artifact;
+
+/**
+ * @author Hervé Boutemy
+ * @since 3.0
+ */
+public enum DependencyScope
+{
+    COMPILE( Artifact.SCOPE_COMPILE ),
+    COMPILE_PLUS_RUNTIME( Artifact.SCOPE_COMPILE_PLUS_RUNTIME ),
+    RUNTIME( Artifact.SCOPE_RUNTIME ),
+    TEST( Artifact.SCOPE_TEST );
+
+    private final String id;
+
+    DependencyScope( String id )
+    {
+        this.id = id;
+    }
+
+    public String id()
+    {
+        return this.id;
+    }
+}

Propchange: maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/DependencyScope.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/DependencyScope.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/DependencyScope.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Mojo.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Mojo.java?rev=1337586&r1=1337585&r2=1337586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Mojo.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Mojo.java Sat May 12 16:14:40 2012
@@ -40,9 +40,9 @@ public @interface Mojo
 
     LifecyclePhase defaultPhase() default LifecyclePhase.NONE;
 
-    String requiresDependencyResolution() default "runtime";
+    DependencyScope requiresDependencyResolution() default DependencyScope.RUNTIME;
 
-    String requiresDependencyCollection() default "";
+    DependencyScope requiresDependencyCollection() default DependencyScope.RUNTIME;
 
     String instantiationStrategy() default "per-lookup";
 

Modified: maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java?rev=1337586&r1=1337585&r2=1337586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java Sat May 12 16:14:40 2012
@@ -454,8 +454,8 @@ public class JavaAnnotationsMojoDescript
             mojo.setDeprecated( mojo.getDeprecated() );
 
             mojoDescriptor.setAggregator( mojo.aggregator() );
-            mojoDescriptor.setDependencyResolutionRequired( mojo.requiresDependencyResolution() );
-            mojoDescriptor.setDependencyCollectionRequired( mojo.requiresDependencyCollection() );
+            mojoDescriptor.setDependencyResolutionRequired( mojo.requiresDependencyResolution().toString() );
+            mojoDescriptor.setDependencyCollectionRequired( mojo.requiresDependencyCollection().toString() );
 
             mojoDescriptor.setDirectInvocationOnly( mojo.requiresDirectInvocation() );
             mojoDescriptor.setDeprecated( mojo.getDeprecated() );

Modified: maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/MojoAnnotationContent.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/MojoAnnotationContent.java?rev=1337586&r1=1337585&r2=1337586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/MojoAnnotationContent.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/MojoAnnotationContent.java Sat May 12 16:14:40 2012
@@ -19,6 +19,7 @@ package org.apache.maven.tools.plugin.an
  * under the License.
  */
 
+import org.apache.maven.plugins.annotations.DependencyScope;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 
@@ -36,9 +37,9 @@ public class MojoAnnotationContent
 
     private LifecyclePhase defaultPhase = LifecyclePhase.NONE;
 
-    private String requiresDependencyResolution = "runtime";
+    private DependencyScope requiresDependencyResolution = DependencyScope.RUNTIME;
 
-    private String requiresDependencyCollection;
+    private DependencyScope requiresDependencyCollection = DependencyScope.RUNTIME;
 
     private String instantiationStrategy = "per-lookup";
 
@@ -75,22 +76,22 @@ public class MojoAnnotationContent
         this.defaultPhase = LifecyclePhase.valueOf( phase );
     }
 
-    public String requiresDependencyResolution()
+    public DependencyScope requiresDependencyResolution()
     {
         return requiresDependencyResolution;
     }
 
-    public void requiresDependencyResolution( String requiresDependencyResolution )
+    public void requiresDependencyResolution( DependencyScope requiresDependencyResolution )
     {
         this.requiresDependencyResolution = requiresDependencyResolution;
     }
 
-    public String requiresDependencyCollection()
+    public DependencyScope requiresDependencyCollection()
     {
-        return requiresDependencyCollection == null ? "" : requiresDependencyCollection;
+        return requiresDependencyCollection;
     }
 
-    public void requiresDependencyCollection( String requiresDependencyCollection )
+    public void requiresDependencyCollection( DependencyScope requiresDependencyCollection )
     {
         this.requiresDependencyCollection = requiresDependencyCollection;
     }

Modified: maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/site/apt/index.apt?rev=1337586&r1=1337585&r2=1337586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/site/apt/index.apt (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/site/apt/index.apt Sat May 12 16:14:40 2012
@@ -36,6 +36,8 @@ Maven Plugin Tool for Annotations
 
 +---------+
 import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugins.annotations.DependencyScope;
+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;
@@ -53,8 +55,8 @@ import org.apache.maven.plugins.annotati
        inheritByDefault = <true|false>,
        instantiationStrategy = "<per-lookup|singleton|keep-alive|poolable>",
        defaultPhase = "<phaseName>",
-       requiresDependencyResolution = "<compile|runtime|compile+runtime|test>",
-       requiresDependencyCollection = "<compile|runtime|compile+runtime|test>", // (since Maven 3.0)
+       requiresDependencyResolution = DependencyScope.<scope>,
+       requiresDependencyCollection = DependencyScope.<scope>, // (since Maven 3.0)
        requiresDirectInvocation = <false|true>,
        requiresOnline = <false|true>,
        requiresProject = <true|false>,