You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Marc L. Veary" <ma...@mlveary.demon.co.uk> on 2006/08/25 08:57:04 UTC
Plugin Development Issue
Hi,
I have developed a very simple plugin that does nothing. (code included
below).
The problem is that I cannot seem to pass in a parameter either on the
command line or via a POM (in another project that defines this plugin in
the <build> section):
mvn cleartrust:extract -Dverbose=Testing
or
<configuration>
<verbose>testing</verbose>
</configuration>
Could someone point me in the right direction here?
package uk.co.nwlcoc.aa.maven.plugins;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
/**
* @goal extract
* @phase package
* @author Marc
* @version $LastChangedRevision$
*/
public class ClearTrustMojo extends AbstractMojo
{
/**
* @parameter
*/
private String verbose;
public void execute() throws MojoExecutionException, MojoFailureException
{
getLog().info( ">> " + verbose );
}
}
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>uk.co.nwlcoc.aa.maven.plugins</groupId>
<artifactId>maven-cleartrust-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>1.0-SNAPSHOT</version>
<name>ClearTrust Mojo</name>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
</project>
Kind regards,
--
Marc
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Plugin Development Issue
Posted by "Marc L. Veary" <ma...@mlveary.demon.co.uk>.
Ha!
Yet again. Everytime I email this list for some help, I then solve the
problem... sorry all.
The answer to the problem seems to be that one must provide the 'expression'
to the annotation:
/**
* @parameter expression="${verbose}"
*/
private String verbose;
This now works from both POM and command line.
Many apologies for any time wasted.
Kind regards,
--
Marc
-----Original Message-----
From: Marc L. Veary [mailto:marc@mlveary.demon.co.uk]
Sent: 25 August 2006 07:57
To: 'Maven Users'
Subject: Plugin Development Issue
Hi,
I have developed a very simple plugin that does nothing. (code included
below).
The problem is that I cannot seem to pass in a parameter either on the
command line or via a POM (in another project that defines this plugin in
the <build> section):
mvn cleartrust:extract -Dverbose=Testing
or
<configuration>
<verbose>testing</verbose>
</configuration>
Could someone point me in the right direction here?
package uk.co.nwlcoc.aa.maven.plugins;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
/**
* @goal extract
* @phase package
* @author Marc
* @version $LastChangedRevision$
*/
public class ClearTrustMojo extends AbstractMojo
{
/**
* @parameter
*/
private String verbose;
public void execute() throws MojoExecutionException, MojoFailureException
{
getLog().info( ">> " + verbose );
}
}
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>uk.co.nwlcoc.aa.maven.plugins</groupId>
<artifactId>maven-cleartrust-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>1.0-SNAPSHOT</version>
<name>ClearTrust Mojo</name>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
</project>
Kind regards,
--
Marc
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org