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 * @deprecated unused 076 */ 077 @Deprecated 078 String executionStrategy() default "once-per-session"; 079 080 /** 081 * does your mojo requires a project to be executed? 082 * @return requires a project 083 */ 084 boolean requiresProject() default true; 085 086 /** 087 * does your mojo requires a reporting context to be executed? 088 * @return requires a reporting context 089 * 090 * @deprecated unused 091 */ 092 @Deprecated 093 boolean requiresReports() default false; 094 095 /** 096 * if the Mojo uses the Maven project and its child modules. 097 * @return uses the Maven project and its child modules 098 */ 099 boolean aggregator() default false; 100 101 /** 102 * can this Mojo be invoked directly only? 103 * @return invoked directly only 104 * 105 * @deprecated unused 106 */ 107 @Deprecated 108 boolean requiresDirectInvocation() default false; 109 110 /** 111 * does this Mojo need to be online to be executed? 112 * @return need to be online 113 */ 114 boolean requiresOnline() default false; 115 116 /** 117 * @deprecated unused 118 */ 119 @Deprecated 120 boolean inheritByDefault() default true; 121 122 /** 123 * own configurator class. 124 * @return own configurator class 125 */ 126 String configurator() default ""; 127 128 /** 129 * is your mojo thread safe (since Maven 3.x)? 130 * @return is thread safe 131 */ 132 boolean threadSafe() default false; 133}