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