Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

This page will adress the fourth concept of maven : the plugins

It will talk about the plugins' goals are hooked to the phases

about the plugins are configurated in the pom and the goal can be hooked in the pom when not hooked by default 


Example 1

This will allow Maven to inject the classpath defined by your dependencies in
the POM, plus the target/classes directory available after the compile phase runs.

 * @parameter default-value="${project.compileClasspathElements}" * @requiresDependencyResolution compile
 * @required
 * @readonly
private List compileClasspathElements;

Then, to use it, you should construct a new classloader:

URL[] urls = new URL[compileClasspathElements.size()];

for ( int i = 0; i < compileClasspathElements.size(); i++ )
    File classpathElement = (File) compileClasspathElements.get( i );
    urls[i] = classpathElement.toURL();

ClassLoader cl = new URLClassLoader( urls );

Then, use the new classloader...

20070212 jdcasey on #maven, reposted with permission

  • No labels