View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.tools.plugin.extractor.annotations;
20  
21  import java.util.List;
22  
23  import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
24  import org.apache.maven.plugin.MojoExecutionException;
25  import org.apache.maven.plugins.annotations.Component;
26  import org.apache.maven.plugins.annotations.Execute;
27  import org.apache.maven.plugins.annotations.LifecyclePhase;
28  import org.apache.maven.plugins.annotations.Mojo;
29  import org.apache.maven.plugins.annotations.Parameter;
30  
31  /**
32   * @author Olivier Lamy
33   */
34  @Mojo(name = "foo", defaultPhase = LifecyclePhase.COMPILE, threadSafe = true)
35  @Execute(goal = "compiler", lifecycle = "my-lifecycle", phase = LifecyclePhase.PACKAGE)
36  public class FooMojo extends AbstractFooMojo {
37      /**
38       * the cool bar to go
39       * @since 1.0
40       */
41      @Parameter(property = "thebar", required = true, defaultValue = "coolbar")
42      protected String bar;
43  
44      /**
45       * Setter method for Parameter field
46       */
47      public void setBar(String bar) {
48          this.bar = bar;
49      }
50  
51      /**
52       * beer for non french folks
53       * @deprecated wine is better
54       */
55      @Deprecated
56      @Parameter(property = "thebeer", defaultValue = "coolbeer")
57      protected String beer;
58  
59      /**
60       * Field for setter method
61       */
62      private String paramFromSetter;
63  
64      /**
65       * setter as parameter.
66       */
67      @Parameter(property = "props.paramFromSetter")
68      public void setParamFromSetter(String value) {
69          this.paramFromSetter = paramFromSetter;
70      }
71  
72      /**
73       * add method as parameter.
74       */
75      @Parameter(property = "props.paramFromAdd")
76      public void addParamFromAdd(String value) {
77          // empty
78      }
79  
80      /**
81       * deprecated setter as parameter.
82       *
83       * @deprecated reason of deprecation
84       */
85      @Deprecated
86      @Parameter(property = "props.paramFromSetterDeprecated")
87      public void setParamFromSetterDeprecated(List<String> value) {
88          // empty
89      }
90  
91      /**
92       * Static methods should be excluded.
93       */
94      @Parameter
95      public static void setStaticMethod(String value) {
96          // empty
97      }
98  
99      /**
100      *
101      */
102     @Component(role = ArtifactMetadataSource.class, hint = "maven")
103     protected ArtifactMetadataSource artifactMetadataSource;
104 
105     @Override
106     public void execute() throws MojoExecutionException {
107         // nothing
108     }
109 
110     @Deprecated
111     public void deprecatedMethod(String value) {}
112 }