You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2022/05/23 18:24:01 UTC

[maven-plugin-tools] branch MPLUGIN-396 created (now 425e18c4)

This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a change to branch MPLUGIN-396
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git


      at 425e18c4 [MPLUGIN-396] Allow @Deprecated annotation without javadoc tag

This branch includes the following new commits:

     new 425e18c4 [MPLUGIN-396] Allow @Deprecated annotation without javadoc tag

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-plugin-tools] 01/01: [MPLUGIN-396] Allow @Deprecated annotation without javadoc tag

Posted by sj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a commit to branch MPLUGIN-396
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git

commit 425e18c4712cb67f69db55049995057502a53082
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Mon May 23 20:01:13 2022 +0200

    [MPLUGIN-396] Allow @Deprecated annotation without javadoc tag
---
 .../expected-help.txt                              | 25 ++++++
 .../invoker.properties                             | 23 ++++++
 .../help-basic-deprecated-annotation-only/pom.xml  | 87 +++++++++++++++++++++
 .../src/main/java/test/MyMojo.java                 | 67 ++++++++++++++++
 .../test.properties                                | 19 +++++
 .../verify.groovy                                  | 74 +++++++-----------
 .../apache/maven/plugin/coreit/MPlugin396Mojo.java | 89 +++++++++++-----------
 .../src/it/java-basic-annotations/verify.groovy    |  7 ++
 .../scanner/DefaultMojoAnnotationsScanner.java     | 21 ++++-
 .../scanner/MojoAnnotationsScanner.java            |  8 +-
 .../scanner/visitors/MojoClassVisitor.java         |  9 +--
 .../scanner/visitors/MojoFieldVisitor.java         | 12 ++-
 ...tationsScannerTest.java => DeprecatedMojo.java} | 89 +++++++++++-----------
 .../scanner/DefaultMojoAnnotationsScannerTest.java | 42 +++++++++-
 14 files changed, 416 insertions(+), 156 deletions(-)

diff --git a/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/expected-help.txt b/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/expected-help.txt
new file mode 100644
index 00000000..4c5b7ed8
--- /dev/null
+++ b/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/expected-help.txt
@@ -0,0 +1,25 @@
+[INFO] help 1.0-SNAPSHOT
+  Tests generation and compilation of the help mojo.
+
+help:test
+  Deprecated. No reason given
+
+  MOJO-DESCRIPTION. Some 'quotation' marks and backslashes '\\', some important
+  javadoc
+  and an inline link to AnotherMojo.
+
+  Available parameters:
+
+    defaultParam (Default: escape\backslash)
+      This parameter uses 'quotation' marks and backslashes '\\' in its
+      description. Those characters must be escaped in Java string literals.
+
+    deprecatedParam
+      Deprecated. No reason given
+
+      This parameter is deprecated.
+
+    undocumentedParam
+      
+      Required: Yes
+      User property: test.undocumented
diff --git a/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/invoker.properties b/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/invoker.properties
new file mode 100644
index 00000000..544361b7
--- /dev/null
+++ b/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/invoker.properties
@@ -0,0 +1,23 @@
+# 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.
+
+invoker.maven.version = 3.0+
+invoker.goals.1 = clean install -DskipTests
+invoker.goals.2 = org.apache.maven.its.plugin:help:1.0-SNAPSHOT:help
+invoker.goals.3 = --log-file help.log org.apache.maven.its.plugin:help:1.0-SNAPSHOT:help
+# --log-file option is only supported by Maven 3
+invoker.maven.version = 3.0+
diff --git a/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/pom.xml b/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/pom.xml
new file mode 100644
index 00000000..2675d8ec
--- /dev/null
+++ b/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/pom.xml
@@ -0,0 +1,87 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.plugin</groupId>
+  <artifactId>help</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>maven-plugin</packaging>
+
+  <description>
+    Tests generation and compilation of the help mojo.
+  </description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-plugin-api</artifactId>
+      <version>@mavenVersion@</version>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>3.0.1</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.plugin-tools</groupId>
+      <artifactId>maven-plugin-annotations</artifactId>
+      <version>@project.version@</version>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>2.4</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>default-descriptor</id>
+            <phase>process-classes</phase>
+          </execution>
+          <execution>
+            <id>help-goal</id>
+            <goals>
+              <goal>helpmojo</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/src/main/java/test/MyMojo.java b/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/src/main/java/test/MyMojo.java
new file mode 100644
index 00000000..6732aa8c
--- /dev/null
+++ b/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/src/main/java/test/MyMojo.java
@@ -0,0 +1,67 @@
+package test;
+
+/*
+ * 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;
+import org.apache.maven.plugins.annotations.Parameter;
+
+/**
+ * MOJO-DESCRIPTION. Some "quotation" marks and backslashes '\\', some <strong>important</strong> javadoc<br> and an
+ * inline link to {@link test.AnotherMojo}.
+ * 
+ * @since 2.1
+ */
+@Deprecated
+@Mojo( name= "test" )
+public class MyMojo
+    extends AbstractMojo
+{
+
+    /**
+     * This parameter uses "quotation" marks and backslashes '\\' in its description. Those characters <em>must</em> be
+     * escaped in Java string literals.
+     * 
+     * @since 2.0
+     */
+    @Parameter( defaultValue = "escape\\backslash" )
+    private String defaultParam;
+
+    /**
+     * This parameter is deprecated.
+     */
+    @Deprecated
+    @Parameter
+    private String deprecatedParam;
+
+    @Parameter( property = "test.undocumented", required = true )
+    private String undocumentedParam;
+
+    /**
+     * Readonly parameter: should not be proposed for configuration.
+     */
+    @Parameter( defaultValue = "not for configuration", readonly = true )
+    private String readonly;
+
+    public void execute()
+    {
+    }
+
+}
diff --git a/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/test.properties b/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/test.properties
new file mode 100644
index 00000000..16e4de3c
--- /dev/null
+++ b/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/test.properties
@@ -0,0 +1,19 @@
+# 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.
+
+detail = true
+goal = test
diff --git a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java b/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/verify.groovy
similarity index 50%
copy from maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java
copy to maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/verify.groovy
index 11508b83..219231bd 100644
--- a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java
+++ b/maven-plugin-plugin/src/it/help-basic-deprecated-annotation-only/verify.groovy
@@ -1,46 +1,28 @@
-package org.apache.maven.tools.plugin.extractor.annotations.scanner;
-
-/*
- * 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 static org.mockito.Mockito.mock;
-
-import java.io.File;
-
-import org.codehaus.plexus.logging.Logger;
-import org.junit.Test;
-
-public class DefaultMojoAnnotationsScannerTest
-{
-    private DefaultMojoAnnotationsScanner scanner = new DefaultMojoAnnotationsScanner();
-
-    @Test
-    public void testSkipModuleInfoClassInArchive() throws Exception
-    {
-        scanner.scanArchive( new File( "target/test-classes/java9-module.jar"), null, false );
-    }
-    
-    @Test
-    public void testJava8Annotations() throws Exception
-    {
-        scanner.enableLogging( mock( Logger.class ) );
-        scanner.scanArchive( new File( "target/test-classes/java8-annotations.jar"), null, false );
-    }
-
-}
+/*
+ * 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.
+ */
+
+expected = new File( basedir, "expected-help.txt" ).text.trim().replace( "\r", "" )
+
+log = new File( basedir, "help.log" ).text.replace( "\r", "" )
+log = log.substring( log.indexOf( "[INFO] help 1.0-SNAPSHOT" ) )
+log = log.substring( 0, log.indexOf( "[INFO]", 5 ) ).trim()
+
+assert log == expected
+
+return true
diff --git a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java b/maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/MPlugin396Mojo.java
similarity index 51%
copy from maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java
copy to maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/MPlugin396Mojo.java
index 11508b83..57c45d83 100644
--- a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java
+++ b/maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/MPlugin396Mojo.java
@@ -1,46 +1,43 @@
-package org.apache.maven.tools.plugin.extractor.annotations.scanner;
-
-/*
- * 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 static org.mockito.Mockito.mock;
-
-import java.io.File;
-
-import org.codehaus.plexus.logging.Logger;
-import org.junit.Test;
-
-public class DefaultMojoAnnotationsScannerTest
-{
-    private DefaultMojoAnnotationsScanner scanner = new DefaultMojoAnnotationsScanner();
-
-    @Test
-    public void testSkipModuleInfoClassInArchive() throws Exception
-    {
-        scanner.scanArchive( new File( "target/test-classes/java9-module.jar"), null, false );
-    }
-    
-    @Test
-    public void testJava8Annotations() throws Exception
-    {
-        scanner.enableLogging( mock( Logger.class ) );
-        scanner.scanArchive( new File( "target/test-classes/java8-annotations.jar"), null, false );
-    }
-
-}
+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.Component;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProjectHelper;
+
+@Deprecated
+@Mojo( name = "mplugin-396" )
+public class MPlugin396Mojo
+    extends AbstractMojo
+{
+    @Deprecated
+    @Parameter
+    private String param;
+
+    @Component
+    private MavenProjectHelper projectHelper;
+
+    public void execute()
+    {
+    }
+}
diff --git a/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy b/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy
index 294f5386..0541a8f1 100644
--- a/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy
+++ b/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy
@@ -228,4 +228,11 @@ assert new File( basedir, "target/classes/org/apache/maven/plugin/coreit/HelpMoj
 assert new File( basedir, "target/generated-sources/plugin/org/apache/maven/plugin/coreit/HelpMojo.java" ).isFile()
 assert !new File( basedir, "target/generated-sources/plugin/HelpMojo.java" ).isFile()
 
+// check values set by deprecated annotation only
+mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "mplugin-396"}[0]
+assert mojo.deprecated.text() == 'No reason given'
+
+parameter = mojo.parameters.parameter.findAll{ it.name.text() == "param" }[0]
+assert parameter.deprecated.text() == 'No reason given'
+
 return true;
diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScanner.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScanner.java
index d53848fd..a2222de6 100644
--- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScanner.java
+++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScanner.java
@@ -271,6 +271,12 @@ public class DefaultMojoAnnotationsScanner
             {
                 MojoAnnotationContent mojoAnnotationContent = new MojoAnnotationContent();
                 populateAnnotationContent( mojoAnnotationContent, mojoAnnotationVisitor );
+
+                if ( mojoClassVisitor.getAnnotationVisitor( Deprecated.class ) != null )
+                {
+                    mojoAnnotationContent.setDeprecated( "" );
+                }
+
                 mojoAnnotatedClass.setMojo( mojoAnnotationContent );
             }
 
@@ -289,10 +295,15 @@ public class DefaultMojoAnnotationsScanner
             {
                 ParameterAnnotationContent parameterAnnotationContent =
                     new ParameterAnnotationContent( mojoFieldVisitor.getFieldName(), mojoFieldVisitor.getClassName() );
-                if ( mojoFieldVisitor.getMojoAnnotationVisitor() != null )
+
+                Map<String, MojoAnnotationVisitor> annotationVisitorMap = mojoFieldVisitor.getAnnotationVisitorMap();
+                MojoAnnotationVisitor fieldAnnotationVisitor = annotationVisitorMap.get( Parameter.class.getName() );
+
+                populateAnnotationContent( parameterAnnotationContent, fieldAnnotationVisitor );
+
+                if ( annotationVisitorMap.containsKey( Deprecated.class.getName() ) )
                 {
-                    populateAnnotationContent( parameterAnnotationContent,
-                                               mojoFieldVisitor.getMojoAnnotationVisitor() );
+                    parameterAnnotationContent.setDeprecated( "" );
                 }
 
                 mojoAnnotatedClass.getParameters().put( parameterAnnotationContent.getFieldName(),
@@ -306,7 +317,9 @@ public class DefaultMojoAnnotationsScanner
                 ComponentAnnotationContent componentAnnotationContent =
                     new ComponentAnnotationContent( mojoFieldVisitor.getFieldName() );
 
-                MojoAnnotationVisitor annotationVisitor = mojoFieldVisitor.getMojoAnnotationVisitor();
+                Map<String, MojoAnnotationVisitor> annotationVisitorMap = mojoFieldVisitor.getAnnotationVisitorMap();
+                MojoAnnotationVisitor annotationVisitor = annotationVisitorMap.get( Component.class.getName() );
+
                 if ( annotationVisitor != null )
                 {
                     for ( Map.Entry<String, Object> entry : annotationVisitor.getAnnotationValues().entrySet() )
diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/MojoAnnotationsScanner.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/MojoAnnotationsScanner.java
index a5add2f9..a4e76199 100644
--- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/MojoAnnotationsScanner.java
+++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/MojoAnnotationsScanner.java
@@ -37,9 +37,13 @@ public interface MojoAnnotationsScanner
 {
     String ROLE = MojoAnnotationsScanner.class.getName();
 
-    List<String> CLASS_LEVEL_ANNOTATIONS = Arrays.asList( Mojo.class.getName(), Execute.class.getName() );
+    List<String> CLASS_LEVEL_ANNOTATIONS = Arrays.asList( Mojo.class.getName(),
+                                                          Execute.class.getName(),
+                                                          Deprecated.class.getName() );
 
-    List<String> FIELD_LEVEL_ANNOTATIONS = Arrays.asList( Parameter.class.getName(), Component.class.getName() );
+    List<String> FIELD_LEVEL_ANNOTATIONS = Arrays.asList( Parameter.class.getName(),
+                                                          Component.class.getName(),
+                                                          Deprecated.class.getName() );
 
     /**
      * Scan classes for mojo annotations.
diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/visitors/MojoClassVisitor.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/visitors/MojoClassVisitor.java
index 6ebf4c66..40120347 100644
--- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/visitors/MojoClassVisitor.java
+++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/visitors/MojoClassVisitor.java
@@ -34,7 +34,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
 
 /**
  * @author Olivier Lamy
@@ -96,13 +95,13 @@ public class MojoClassVisitor
     {
         String annotationClassName = annotation.getName();
 
-        List<MojoFieldVisitor> mojoFieldVisitors = new ArrayList<MojoFieldVisitor>();
+        List<MojoFieldVisitor> mojoFieldVisitors = new ArrayList<>();
 
         for ( MojoFieldVisitor mojoFieldVisitor : this.fieldVisitors )
         {
-            MojoAnnotationVisitor mojoAnnotationVisitor = mojoFieldVisitor.getMojoAnnotationVisitor();
-            if ( mojoAnnotationVisitor != null && Objects.equals( annotationClassName,
-                                                                      mojoAnnotationVisitor.getAnnotationClassName() ) )
+            Map<String, MojoAnnotationVisitor> filedVisitorMap = mojoFieldVisitor.getAnnotationVisitorMap();
+
+            if (  filedVisitorMap.containsKey( annotationClassName ) )
             {
                 mojoFieldVisitors.add( mojoFieldVisitor );
             }
diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/visitors/MojoFieldVisitor.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/visitors/MojoFieldVisitor.java
index b3d03537..f69ae060 100644
--- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/visitors/MojoFieldVisitor.java
+++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/visitors/MojoFieldVisitor.java
@@ -19,6 +19,9 @@ package org.apache.maven.tools.plugin.extractor.annotations.scanner.visitors;
  * under the License.
  */
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.maven.tools.plugin.extractor.annotations.scanner.MojoAnnotationsScanner;
 import org.codehaus.plexus.logging.Logger;
 import org.objectweb.asm.AnnotationVisitor;
@@ -38,7 +41,7 @@ public class MojoFieldVisitor
 
     private String fieldName;
 
-    private MojoAnnotationVisitor mojoAnnotationVisitor;
+    private Map<String, MojoAnnotationVisitor> annotationVisitorMap = new HashMap<>();
 
     private String className;
 
@@ -50,9 +53,9 @@ public class MojoFieldVisitor
         this.className = className;
     }
 
-    public MojoAnnotationVisitor getMojoAnnotationVisitor()
+    public Map<String, MojoAnnotationVisitor> getAnnotationVisitorMap()
     {
-        return mojoAnnotationVisitor;
+        return annotationVisitorMap;
     }
 
     public String getFieldName()
@@ -68,7 +71,8 @@ public class MojoFieldVisitor
         {
             return null;
         }
-        mojoAnnotationVisitor = new MojoAnnotationVisitor( logger, annotationClassName );
+        MojoAnnotationVisitor mojoAnnotationVisitor = new MojoAnnotationVisitor( logger, annotationClassName );
+        annotationVisitorMap.put( annotationClassName, mojoAnnotationVisitor );
         return mojoAnnotationVisitor;
     }
 
diff --git a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java b/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/DeprecatedMojo.java
similarity index 51%
copy from maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java
copy to maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/DeprecatedMojo.java
index 11508b83..74e97683 100644
--- a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java
+++ b/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/DeprecatedMojo.java
@@ -1,46 +1,43 @@
-package org.apache.maven.tools.plugin.extractor.annotations.scanner;
-
-/*
- * 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 static org.mockito.Mockito.mock;
-
-import java.io.File;
-
-import org.codehaus.plexus.logging.Logger;
-import org.junit.Test;
-
-public class DefaultMojoAnnotationsScannerTest
-{
-    private DefaultMojoAnnotationsScanner scanner = new DefaultMojoAnnotationsScanner();
-
-    @Test
-    public void testSkipModuleInfoClassInArchive() throws Exception
-    {
-        scanner.scanArchive( new File( "target/test-classes/java9-module.jar"), null, false );
-    }
-    
-    @Test
-    public void testJava8Annotations() throws Exception
-    {
-        scanner.enableLogging( mock( Logger.class ) );
-        scanner.scanArchive( new File( "target/test-classes/java8-annotations.jar"), null, false );
-    }
-
-}
+package org.apache.maven.tools.plugin.extractor.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.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+
+@Deprecated
+@Mojo( name = "deprecated-mojo" )
+public class DeprecatedMojo extends AbstractMojo
+{
+    @Deprecated
+    @Parameter( alias = "deprecatedParametersAlias" )
+    private String deprecatedParameters;
+
+    @Parameter( property = "property.anotherNotDeprecated" )
+    private String anotherNotDeprecated;
+
+    @Override
+    public void execute() throws MojoExecutionException, MojoFailureException
+    {
+    }
+}
diff --git a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java b/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java
index 11508b83..401f4e20 100644
--- a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java
+++ b/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/scanner/DefaultMojoAnnotationsScannerTest.java
@@ -19,10 +19,19 @@ package org.apache.maven.tools.plugin.extractor.annotations.scanner;
  * under the License.
  */
 
+import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
 
 import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Map;
 
+import org.apache.maven.tools.plugin.extractor.ExtractionException;
+import org.apache.maven.tools.plugin.extractor.annotations.AbstractFooMojo;
+import org.apache.maven.tools.plugin.extractor.annotations.DeprecatedMojo;
+import org.apache.maven.tools.plugin.extractor.annotations.FooMojo;
 import org.codehaus.plexus.logging.Logger;
 import org.junit.Test;
 
@@ -33,14 +42,41 @@ public class DefaultMojoAnnotationsScannerTest
     @Test
     public void testSkipModuleInfoClassInArchive() throws Exception
     {
-        scanner.scanArchive( new File( "target/test-classes/java9-module.jar"), null, false );
+        scanner.scanArchive( new File( "target/test-classes/java9-module.jar" ), null, false );
     }
-    
+
     @Test
     public void testJava8Annotations() throws Exception
     {
         scanner.enableLogging( mock( Logger.class ) );
-        scanner.scanArchive( new File( "target/test-classes/java8-annotations.jar"), null, false );
+        scanner.scanArchive( new File( "target/test-classes/java8-annotations.jar" ), null, false );
+    }
+
+    @Test
+    public void scanDeprecatedMojoAnnotatins() throws ExtractionException, IOException
+    {
+        File directoryToScan = new File( DeprecatedMojo.class.getResource( "" ).getFile() );
+
+        scanner.enableLogging( mock( Logger.class ) );
+        Map<String, MojoAnnotatedClass> result = scanner.scanDirectory(
+            directoryToScan, Collections.singletonList( "DeprecatedMojo.class" ), null, false );
+
+        assertThat( result ).hasSize( 1 );
+
+        MojoAnnotatedClass annotatedClass = result.get( DeprecatedMojo.class.getName() );
+        assertThat( annotatedClass.getClassName() ).isEqualTo( DeprecatedMojo.class.getName() );
+        assertThat( annotatedClass.getMojo().getDeprecated() ).isEmpty();
+
+        assertThat( annotatedClass.getParameters() )
+            .containsOnlyKeys( "deprecatedParameters", "anotherNotDeprecated" );
+
+        assertThat( annotatedClass.getParameters().get( "deprecatedParameters" ).getDeprecated() ).isEmpty();
+        assertThat( annotatedClass.getParameters().get( "deprecatedParameters" ).alias() )
+            .isEqualTo( "deprecatedParametersAlias" );
+
+        assertThat( annotatedClass.getParameters().get( "anotherNotDeprecated" ).getDeprecated() ).isNull();
+        assertThat( annotatedClass.getParameters().get( "anotherNotDeprecated" ).property() )
+            .isEqualTo( "property.anotherNotDeprecated" );
     }
 
 }