You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mirko Friedenhagen <Mi...@webde.de> on 2007/09/13 21:56:51 UTC
[M2] ckjm-mojo: extend classpath with the dependencies of the report project
Hello,
- I am trying to extend the ckjm-mojo (http://mojo.codehaus.org/ckjm-maven-plugin/ckjm-mojo.html).
- ckjm needs the dependencies of the project to report on
- Right now I have the following:
--- snip ---
/**
* The set of dependencies required by the project
*
* @parameter default-value="${project.dependencyArtifacts}"
* @required
* @readonly
*/
private java.util.Set<Artifact> dependencyArtifacts;
/**
* Extends classpath with dependencies. This is needed, as bcel otherwise
* will raise ClassNotFoundExceptions.
*/
void extendClassPathWithDependencies() {
getLog().debug("[ckjm:cjkm] dependencies: " + dependencyArtifacts.toString());
StringBuilder classpath = new StringBuilder(System.getProperty(
"java.class.path", ""));
for (Artifact artifact : dependencyArtifacts) {
classpath.append(File.pathSeparator);
classpath.append(artifact.getFile().getAbsolutePath());
}
getLog().info("[ckjm:cjkm] Setting classpath to: " + classpath.toString());
System.setProperty("java.class.path", classpath.toString());
}
--- snap ---
Is there an automated way to extend the classpath just for this mojo?
Best Regards
Mirko