Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

Examples

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.

No Format
 
/**
 * @parameter default-value="${project.compileClasspathElements}"
 * @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