Wednesday, April 11, 2007

How to Access Project Dependencies in Maven Plugin

I needed to generate a shell script that starts a java process. The shell scripts had to include classpath to all dependencies defined in pom.xml. I decided to write a maven plugin to perform this task. The simplest way to access dependencies in a maven plugin is to define a MavenProject property:

* The Maven project object
* @parameter expression="${project}"

private MavenProject project;

You can access project dependencies by calling: project.getArtifacts()

1 comment:

Anonymous said...

Thanks for this post. I found it on google and it will most likely solve my problems!