001 package 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 022 import java.lang.annotation.Documented; 023 import java.lang.annotation.ElementType; 024 import java.lang.annotation.Inherited; 025 import java.lang.annotation.Retention; 026 import java.lang.annotation.RetentionPolicy; 027 import 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 039 public @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 056 */ 057 ResolutionScope requiresDependencyResolution() default ResolutionScope.NONE; 058 059 /** 060 * the required dependency collection scope. 061 * @return 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 * The original spelling of the instantiationStrategy attribute. 073 * @see #instantiationStrategy() 074 * @return the instantiation strategy 075 */ 076 @Deprecated 077 InstanciationStrategy instanciationStrategy() default InstanciationStrategy.PER_LOOKUP; 078 079 /** 080 * execution strategy: <code>once-per-session</code> or <code>always</code>. 081 * @return <code>once-per-session</code> or <code>always</code> 082 */ 083 String executionStrategy() default "once-per-session"; 084 085 /** 086 * does your mojo requires a project to be executed? 087 * @return 088 */ 089 boolean requiresProject() default true; 090 091 /** 092 * does your mojo requires a reporting context to be executed? 093 * @return 094 */ 095 boolean requiresReports() default false; 096 097 /** 098 * if the Mojo uses the Maven project and its child modules. 099 * @return 100 */ 101 boolean aggregator() default false; 102 103 /** 104 * can this Mojo be invoked directly only? 105 * @return 106 */ 107 boolean requiresDirectInvocation() default false; 108 109 /** 110 * does this Mojo need to be online to be executed? 111 * @return 112 */ 113 boolean requiresOnline() default false; 114 115 boolean inheritByDefault() default true; 116 117 /** 118 * own configurator class. 119 * @return 120 */ 121 String configurator() default ""; 122 123 /** 124 * is your mojo thread safe (since Maven 3.x)? 125 * @return 126 */ 127 boolean threadSafe() default false; 128 }