001package org.apache.maven.plugins.annotations;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import java.lang.annotation.Documented;
023import java.lang.annotation.ElementType;
024import java.lang.annotation.Inherited;
025import java.lang.annotation.Retention;
026import java.lang.annotation.RetentionPolicy;
027import java.lang.annotation.Target;
028
029/**
030 * This annotation will mark your class as a Mojo (ie. goal in a Maven plugin).
031 *
032 * @author Olivier Lamy
033 * @since 3.0
034 */
035@Documented
036@Retention( RetentionPolicy.CLASS )
037@Target( ElementType.TYPE )
038@Inherited
039public @interface Mojo
040{
041    /**
042     * goal name (required).
043     * @return the goal name
044     */
045    String name();
046
047    /**
048     * default phase to bind your mojo.
049     * @return the default phase
050     */
051    LifecyclePhase defaultPhase() default LifecyclePhase.NONE;
052
053    /**
054     * the required dependency resolution scope.
055     * @return the required dependency resolution scope
056     */
057    ResolutionScope requiresDependencyResolution() default ResolutionScope.NONE;
058
059    /**
060     * the required dependency collection scope.
061     * @return the required dependency collection scope 
062     */
063    ResolutionScope requiresDependencyCollection() default ResolutionScope.NONE;
064
065    /**
066     * your Mojo instantiation strategy. (Only <code>per-lookup</code> and <code>singleton</code> are supported)
067     * @return the instantiation strategy
068     */
069    InstantiationStrategy instantiationStrategy() default InstantiationStrategy.PER_LOOKUP;
070
071    /**
072     * execution strategy: <code>once-per-session</code> or <code>always</code>.
073     * @return <code>once-per-session</code> or <code>always</code>
074     */
075    String executionStrategy() default "once-per-session";
076
077    /**
078     * does your mojo requires a project to be executed?
079     * @return requires a project
080     */
081    boolean requiresProject() default true;
082
083    /**
084     * does your mojo requires a reporting context to be executed?
085     * @return requires a reporting context
086     */
087    boolean requiresReports() default false;
088
089    /**
090     * if the Mojo uses the Maven project and its child modules.
091     * @return uses the Maven project and its child modules
092     */
093    boolean aggregator() default false;
094
095    /**
096     * can this Mojo be invoked directly only?
097     * @return invoked directly only
098     */
099    boolean requiresDirectInvocation() default false;
100
101    /**
102     * does this Mojo need to be online to be executed?
103     * @return need to be online
104     */
105    boolean requiresOnline() default false;
106
107    boolean inheritByDefault() default true;
108
109    /**
110     * own configurator class.
111     * @return own configurator class
112     */
113    String configurator() default "";
114
115    /**
116     * is your mojo thread safe (since Maven 3.x)?
117     * @return is thread safe
118     */
119    boolean threadSafe() default false;
120}