Versions Compared

Key

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

...

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}"  
 * @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 );

...