You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Benjamin Bentmann (JIRA)" <ji...@codehaus.org> on 2011/02/22 14:49:23 UTC

[jira] Updated: (MNG-5022) Unable to use a Mojo with a setter

     [ http://jira.codehaus.org/browse/MNG-5022?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Benjamin Bentmann updated MNG-5022:
-----------------------------------

    Description: 
According to documentation (Maven Book, p405), the following example should work ("You can also use these annotations on public setter methods, [..]").
{code:java}
/**
 * @goal echo
 * @requiresProject false
 */
public class EchoMojo extends AbstractMojo {
	private String msg;
	
	/**
	 * @parameter expression="${echo.message}" 
	 */
	public void setMessage(String message) {
		this.msg = message;
	}
	
	public void execute() throws MojoExecutionException,MojoFailureException {
		getLog().info("what now??");
		getLog().info(msg);
		getLog().info("<>");
	}
}
{code}
It does not work.

The generated plugin.xml states, that there are *no* parameters for this Mojo:
{code:xml}
..
    <mojo>
      <goal>echo</goal>
      <description></description>
      <requiresDirectInvocation>false</requiresDirectInvocation>
      <requiresProject>false</requiresProject>
      <requiresReports>false</requiresReports>
      <aggregator>false</aggregator>
      <requiresOnline>false</requiresOnline>
      <inheritedByDefault>true</inheritedByDefault>
      <implementation>org.epo.common.maven.plugins.epo.EchoMojo</implementation>
      <language>java</language>
      <instantiationStrategy>per-lookup</instantiationStrategy>
      <executionStrategy>once-per-session</executionStrategy>
      <threadSafe>false</threadSafe>
      <parameters/>
    </mojo>
..
{code}



  was:
According to documentation (Maven Book, p405), the following example should work ("You can also use these annotations on public setter methods, [..]").

/**
 * @goal echo
 * @requiresProject false
 */
public class EchoMojo extends AbstractMojo {
	private String msg;
	
	/**
	 * @parameter expression="${echo.message}" 
	 */
	public void setMessage(String message) {
		this.msg = message;
	}
	
	public void execute() throws MojoExecutionException,MojoFailureException {
		getLog().info("what now??");
		getLog().info(msg);
		getLog().info("<>");
	}
}

It does not work.

The generated plugin.xml states, that there are *no* parameters for this Mojo:
== plugin.xml ==
..
    <mojo>
      <goal>echo</goal>
      <description></description>
      <requiresDirectInvocation>false</requiresDirectInvocation>
      <requiresProject>false</requiresProject>
      <requiresReports>false</requiresReports>
      <aggregator>false</aggregator>
      <requiresOnline>false</requiresOnline>
      <inheritedByDefault>true</inheritedByDefault>
      <implementation>org.epo.common.maven.plugins.epo.EchoMojo</implementation>
      <language>java</language>
      <instantiationStrategy>per-lookup</instantiationStrategy>
      <executionStrategy>once-per-session</executionStrategy>
      <threadSafe>false</threadSafe>
      <parameters/>
    </mojo>
..
==




> Unable to use a Mojo with a setter
> ----------------------------------
>
>                 Key: MNG-5022
>                 URL: http://jira.codehaus.org/browse/MNG-5022
>             Project: Maven 2 & 3
>          Issue Type: Bug
>          Components: Documentation:  General, Plugin API, Plugin Requests, Plugins and Lifecycle
>    Affects Versions: 2.2.1
>         Environment: $ mvn -version
> Apache Maven 2.2.1 (r801777; 2009-08-06 21:16:01+0200)
> Java version: 1.6.0_22
> Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
> Default locale: en_US, platform encoding: MacRoman
> OS name: "mac os x" version: "10.6.4" arch: "x86_64" Family: "mac"
>            Reporter: wolfgang häfelinger
>            Priority: Critical
>
> According to documentation (Maven Book, p405), the following example should work ("You can also use these annotations on public setter methods, [..]").
> {code:java}
> /**
>  * @goal echo
>  * @requiresProject false
>  */
> public class EchoMojo extends AbstractMojo {
> 	private String msg;
> 	
> 	/**
> 	 * @parameter expression="${echo.message}" 
> 	 */
> 	public void setMessage(String message) {
> 		this.msg = message;
> 	}
> 	
> 	public void execute() throws MojoExecutionException,MojoFailureException {
> 		getLog().info("what now??");
> 		getLog().info(msg);
> 		getLog().info("<>");
> 	}
> }
> {code}
> It does not work.
> The generated plugin.xml states, that there are *no* parameters for this Mojo:
> {code:xml}
> ..
>     <mojo>
>       <goal>echo</goal>
>       <description></description>
>       <requiresDirectInvocation>false</requiresDirectInvocation>
>       <requiresProject>false</requiresProject>
>       <requiresReports>false</requiresReports>
>       <aggregator>false</aggregator>
>       <requiresOnline>false</requiresOnline>
>       <inheritedByDefault>true</inheritedByDefault>
>       <implementation>org.epo.common.maven.plugins.epo.EchoMojo</implementation>
>       <language>java</language>
>       <instantiationStrategy>per-lookup</instantiationStrategy>
>       <executionStrategy>once-per-session</executionStrategy>
>       <threadSafe>false</threadSafe>
>       <parameters/>
>     </mojo>
> ..
> {code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira