Hi Monty,
You shouldn't use ClassLoader.getSystemClassLoader() to lookup your class.
Maven uses a hierarchy of classloaders and by specifying that you want the
systemclassloader, you bypass this completely. Instead, try with
'Class.forName("com.temboo.arcturus.test.choreo.ExpressionChoreoBasicsTest")'
or
'Thread.currentThread().getContextClassLoader().loadClass("com.temboo.arcturus.test.choreo.ExpressionChoreoBasicsTest")'.
A similar reasoning holds for System.getProperty("java.class.path"). Once you
have a Class instance 'clazz' you can use
'clazz.getProtectionDomain().getCodeSource().getLocation()' instead.
Regards,
Marcel
----- Original Message ----
From: Monty Zukowski <[EMAIL PROTECTED]>
To: Maven Users List <[email protected]>
Sent: Monday, May 14, 2007 11:29:46 PM
Subject: Re: classpath clarification
From: Wayne Fay <[EMAIL PROTECTED]>
> You need to tag your mojo with:
> @requiresDependencyResolution test
> Read more here:
> http://maven.apache.org/developers/mojo-api-specification.html
That didn't seem to help:
/**
* @goal testsuite
* @description Will run a testsuite
* @requiresDependencyResolution test
* @phase test
*/
public class TestsuitePlugin
extends AbstractMojo
{
/**
* @parameter expression="${project}"
* @required
*/
private MavenProject project;
public void execute()
throws MojoExecutionException
{
String classpath = System.getProperty("java.class.path");
getLog().info("classpath: " + classpath);
try {
ClassLoader.getSystemClassLoader().loadClass("com.temboo.arcturus.test.choreo.ExpressionChoreoBasicsTest");
getLog().info("got the class!");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Gives:
[INFO] [arcturustestsuite:testsuite {execution: 1}]
[INFO] classpath:
/usr/local/maven-2.0.4/core/boot/classworlds-1.1.jar:/usr/lib/j2sdk1.5-sun//lib/tools.jar
java.lang.ClassNotFoundException:
com.temboo.arcturus.test.choreo.ExpressionChoreoBasicsTest
I assume I should see target/test-classes and friends in the classpath. When I
try to load the class I want to run, it fails saying it's not on the classpath.
Thanks again,
Monty
____________________________________________________________________________________
Get your own web address.
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]