Maven p7: Plugins p2

You can also pass parameters to your java class.

	 * @parameter expression="${our.message}" default-value="default message, innit"
	private Object message;
	public void execute() 
	throws MojoExecutionException, MojoFailureException {

Note that the @parameter is injecting a value, of our.message, into the 'message' variable, giving it a default message if that doesn't exist.

The last part of the parameter, message in this case, must match the java object name.

If you add -Dour.message="something else" on the previous command we ran to execute the plugin, we'll output 'something else' instead of the default.

You can also add it in your pom.xml when you include this plugin into another project. More on that next.

maven maven-plugins

Edit on github
comments powered by Disqus
Click me