views:

39

answers:

2

Hi,

When writing a Maven plugin, you can configure various parameters within the mojo class, e.g.

/**
 * The path to the properties files.
 * 
 * @parameter expression="${project.build.directory}"
 */
private File buildDir;

Is there a reference that lists all the available project properties (e.g. ${project.build.directory})? For example, how do I get the value of the resources directory?

Thanks, Don

+1  A: 

I think you are looking for the Maven Properties Guide.

abhin4v
+1  A: 

Is there a reference that lists all the available project properties (e.g. ${project.build.directory})?

The already mentioned Maven Properties Guide is the place to go. Also be sure to check PLXUTILS-37 that introduced the following syntax:

  • project.dependencies[0] if dependencies is a java.util.List object or an array object
  • project.dependenciesAsMap(dep1) if dependenciesAsMap is a java.util.Map object

For example, how do I get the value of the resources directory?

Why would you need this? Resources are typically copied to ${project.build.directory} and you should interact with them from there.

But if you really want to go this way, don't forget that project.build.resources holds a List of Resource (so you might need ${project.build.resources[0].directory}).

Pascal Thivent
Thanks for the response. Is `${project.build.resources[0]}` the correct way to refer to the first (and in my case, only) resource dir?
Don
@Don This will indeed give you the first [Resource](http://maven.apache.org/ref/2.2.1/maven-model/apidocs/org/apache/maven/model/Resource.html) object. I've updated my answer.
Pascal Thivent