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.plugins.annotations;
20
21 import java.lang.annotation.Documented;
22 import java.lang.annotation.ElementType;
23 import java.lang.annotation.Inherited;
24 import java.lang.annotation.Retention;
25 import java.lang.annotation.RetentionPolicy;
26 import java.lang.annotation.Target;
27
28 /**
29 * This annotation will mark your class as a Mojo (ie. goal in a Maven plugin).
30 *
31 * @author Olivier Lamy
32 * @since 3.0
33 */
34 @Documented
35 @Retention(RetentionPolicy.CLASS)
36 @Target(ElementType.TYPE)
37 @Inherited
38 public @interface Mojo {
39 /**
40 * goal name (required).
41 * @return the goal name
42 */
43 String name();
44
45 /**
46 * default phase to bind your mojo.
47 * @return the default phase
48 */
49 LifecyclePhase defaultPhase() default LifecyclePhase.NONE;
50
51 /**
52 * the required dependency resolution scope.
53 * @return the required dependency resolution scope
54 */
55 ResolutionScope requiresDependencyResolution() default ResolutionScope.NONE;
56
57 /**
58 * the required dependency collection scope.
59 * @return the required dependency collection scope
60 */
61 ResolutionScope requiresDependencyCollection() default ResolutionScope.NONE;
62
63 /**
64 * your Mojo instantiation strategy. (Only <code>per-lookup</code> and <code>singleton</code> are supported)
65 * @return the instantiation strategy
66 */
67 InstantiationStrategy instantiationStrategy() default InstantiationStrategy.PER_LOOKUP;
68
69 /**
70 * execution strategy: <code>once-per-session</code> or <code>always</code>.
71 * @return <code>once-per-session</code> or <code>always</code>
72 *
73 * @deprecated unused
74 */
75 @Deprecated
76 String executionStrategy() default "once-per-session";
77
78 /**
79 * does your mojo requires a project to be executed?
80 * @return requires a project
81 */
82 boolean requiresProject() default true;
83
84 /**
85 * does your mojo requires a reporting context to be executed?
86 * @return requires a reporting context
87 *
88 * @deprecated unused
89 */
90 @Deprecated
91 boolean requiresReports() default false;
92
93 /**
94 * if the Mojo uses the Maven project and its child modules.
95 * @return uses the Maven project and its child modules
96 */
97 boolean aggregator() default false;
98
99 /**
100 * can this Mojo be invoked directly only?
101 * @return invoked directly only
102 *
103 * @deprecated unused
104 */
105 @Deprecated
106 boolean requiresDirectInvocation() default false;
107
108 /**
109 * does this Mojo need to be online to be executed?
110 * @return need to be online
111 */
112 boolean requiresOnline() default false;
113
114 /**
115 * @deprecated unused
116 */
117 @Deprecated
118 boolean inheritByDefault() default true;
119
120 /**
121 * own configurator class.
122 * @return own configurator class
123 */
124 String configurator() default "";
125
126 /**
127 * is your mojo thread safe (since Maven 3.x)?
128 * @return is thread safe
129 */
130 boolean threadSafe() default false;
131 }