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.api.plugin.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 import org.apache.maven.api.ResolutionScope;
29 import org.apache.maven.api.annotations.Experimental;
30
31 /**
32 * This annotation will mark your class as a Mojo (ie. goal in a Maven plugin).
33 *
34 * @since 4.0
35 */
36 @Experimental
37 @Documented
38 @Retention(RetentionPolicy.CLASS)
39 @Target(ElementType.TYPE)
40 @Inherited
41 public @interface Mojo {
42 /**
43 * goal name (required).
44 * @return the goal name
45 */
46 String name();
47
48 /**
49 * default phase to bind your mojo.
50 * @return the default phase
51 */
52 LifecyclePhase defaultPhase() default LifecyclePhase.NONE;
53
54 /**
55 * the required dependency resolution scope.
56 * @return the required dependency resolution scope
57 */
58 ResolutionScope requiresDependencyResolution() default ResolutionScope.NONE;
59
60 /**
61 * the required dependency collection scope.
62 * @return the required dependency collection scope
63 */
64 ResolutionScope requiresDependencyCollection() default ResolutionScope.NONE;
65
66 /**
67 * your Mojo instantiation strategy. (Only <code>per-lookup</code> and <code>singleton</code> are supported)
68 * @return the instantiation strategy
69 */
70 InstantiationStrategy instantiationStrategy() default InstantiationStrategy.PER_LOOKUP;
71
72 /**
73 * does your mojo requires a project to be executed?
74 * @return requires a project
75 */
76 boolean requiresProject() default true;
77
78 /**
79 * if the Mojo uses the Maven project and its child modules.
80 * @return uses the Maven project and its child modules
81 */
82 boolean aggregator() default false;
83
84 /**
85 * does this Mojo need to be online to be executed?
86 * @return need to be online
87 */
88 boolean requiresOnline() default false;
89
90 /**
91 * configurator bean name.
92 * @return the configurator bean name
93 */
94 String configurator() default "";
95 }