diff --git a/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Component.java b/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Component.java
index e228674..9afbd65 100644
--- a/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Component.java
+++ b/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Component.java
@@ -29,15 +29,7 @@ import java.lang.annotation.Target;
/**
* Used to configure injection of Plexus components by
*
- * MavenPluginManager.getConfiguredMojo(...) and special Maven
- * objects as well:
- *
MavenPluginManager.getConfiguredMojo(...).
*
* @author Olivier Lamy
* @since 3.0
diff --git a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
index 6cf6689..f934abe 100644
--- a/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
+++ b/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
@@ -588,7 +588,10 @@ public class JavaAnnotationsMojoDescriptorExtractor
}
else
{
- // not a component but a Maven object to be transformed into an expression/property
+ // not a component but a Maven object to be transformed into an expression/property: deprecated
+ getLogger().warn( "Deprecated @component for " + parameter.getName() + " field in "
+ + mojoAnnotatedClass.getClassName() + "."
+ + ": replace with @parameter name=\"" + expression + "\" @readonly" );
parameter.setDefaultValue( expression );
parameter.setType( componentAnnotationContent.getRoleClassName() );
parameter.setRequired( true );
diff --git a/maven-plugin-tools-annotations/src/site/apt/index.apt b/maven-plugin-tools-annotations/src/site/apt/index.apt
index 7965152..558f34b 100644
--- a/maven-plugin-tools-annotations/src/site/apt/index.apt
+++ b/maven-plugin-tools-annotations/src/site/apt/index.apt
@@ -89,22 +89,23 @@ public class MyMojo
hint = "..." )
private MyComponent component;
- @Component
+ // sample objects taken from Maven API through PluginParameterExpressionEvaluator
+
+ @Parameter( defaultValue = "${session}", readonly = true )
private MavenSession session;
- @Component
+ @Parameter( defaultValue = "${project}", readonly = true )
private MavenProject project;
- @Component
+ @Parameter( defaultValue = "${mojoExecution}", readonly = true )
private MojoExecution mojo;
- @Component // for Maven 3 only
+ @Parameter( defaultValue = "${plugin}", readonly = true ) // Maven 3 only
private PluginDescriptor plugin;
- @Component
+ @Parameter( defaultValue = "${settings}", readonly = true )
private Settings settings;
- // sample objects taken from Maven API through PluginParameterExpressionEvaluator
@Parameter( defaultValue = "${project.basedir}", readonly = true )
private File basedir;
diff --git a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java
index 8639a11..d2206dc 100644
--- a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java
+++ b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/util/PluginUtils.java
@@ -45,10 +45,12 @@ public final class PluginUtils
}
/**
- * Expression associated with class types to recognize Maven objects (injected in fact as parameters by
- *
- * maven-core's PluginParameterExpressionEvaluator)
- * like components ("real" components are injected by Plexus).
+ * Expression associated with class types to recognize Maven objects (injected in fact as parameters by
+ * maven-core's PluginParameterExpressionEvaluator) like components ("real" components are injected by Plexus).
+ *
+ * @deprecated wrong approach (fake components), documented parameter default values instead to learn people how to
+ * discover them
*/
public static final Map