You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Monty Zukowski <mo...@temboo.com> on 2007/05/14 20:44:39 UTC
classpath clarification
I've got my own plugin for my own test framework but don't seem to be getting my test classes in the classpath when running the plugin.
For instance:
<plugin>
<groupId>com.temboo.arcturus.maven_testsuite_plugin</groupId>
<artifactId>arcturus-maven-testsuite-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<executions>
<execution>
<phase>test</phase>
<id>1</id>
<configuration>
</configuration>
<goals>
<goal>testsuite</goal>
</goals>
</execution>
</executions>
</plugin>
...
public void execute()
throws MojoExecutionException
{
String classpath = System.getProperty("java.class.path");
getLog().info("classpath: " + classpath);
prints this:
classpath: /usr/local/maven-2.0.4/core/boot/classworlds-1.1.jar:/usr/lib/j2sdk1.5-sun//lib/tools.jar
which shows none of the compiled classes in there. I was expecting since I specified the <phase>test</phase> that it would be set up to have the test classes in the classpath already.
So I tried to pass in the classpath I need, something like this:
<plugin>
<groupId>com.temboo.arcturus.maven_testsuite_plugin</groupId>
<artifactId>arcturus-maven-testsuite-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<executions>
<execution>
<phase>test</phase>
<id>1</id>
<configuration>
<path id='project.class.path'>
<path refid='maven.test.classpath'/>
<path refid='maven.runtime.classpath'/>
<path refid='maven.dependency.classpath'/>
<path refid='maven.compile.classpath'/>
<path refid='maven.plugin.classpath'/>
</path>
<cp>${project.class.path}</cp>
<suitefile>${basedir}/testng.xml</suitefile>
</configuration>
<goals>
<goal>testsuite</goal>
</goals>
</execution>
</executions>
</plugin>
...
/**
* @parameter expression="whatever"
* @required
*/
private String cp;
public void execute()
throws MojoExecutionException
{
getLog().info("classpath: " + cp);
String classpath = System.getProperty("java.class.path");
getLog().info("old classpath: " + classpath);
And that told me that ${project.class.path} was undefined. So, one question is how do I pass the path along to the plugin?
But the big question is, how do I specify that I want this plugin to be run with the maven.test.classpath?
Thanks,
Monty
Re: classpath clarification
Posted by Wayne Fay <wa...@gmail.com>.
You need to tag your mojo with:
@requiresDependencyResolution test
Read more here:
http://maven.apache.org/developers/mojo-api-specification.html
Wayne
On 5/14/07, Monty Zukowski <mo...@temboo.com> wrote:
> I've got my own plugin for my own test framework but don't seem to be getting my test classes in the classpath when running the plugin.
>
> For instance:
>
> <plugin>
> <groupId>com.temboo.arcturus.maven_testsuite_plugin</groupId>
> <artifactId>arcturus-maven-testsuite-plugin</artifactId>
> <version>1.0-SNAPSHOT</version>
> <executions>
> <execution>
> <phase>test</phase>
> <id>1</id>
> <configuration>
> </configuration>
> <goals>
> <goal>testsuite</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> ...
> public void execute()
> throws MojoExecutionException
> {
> String classpath = System.getProperty("java.class.path");
> getLog().info("classpath: " + classpath);
>
> prints this:
> classpath: /usr/local/maven-2.0.4/core/boot/classworlds-1.1.jar:/usr/lib/j2sdk1.5-sun//lib/tools.jar
>
> which shows none of the compiled classes in there. I was expecting since I specified the <phase>test</phase> that it would be set up to have the test classes in the classpath already.
>
> So I tried to pass in the classpath I need, something like this:
>
> <plugin>
> <groupId>com.temboo.arcturus.maven_testsuite_plugin</groupId>
> <artifactId>arcturus-maven-testsuite-plugin</artifactId>
> <version>1.0-SNAPSHOT</version>
> <executions>
> <execution>
> <phase>test</phase>
> <id>1</id>
> <configuration>
> <path id='project.class.path'>
> <path refid='maven.test.classpath'/>
> <path refid='maven.runtime.classpath'/>
> <path refid='maven.dependency.classpath'/>
> <path refid='maven.compile.classpath'/>
> <path refid='maven.plugin.classpath'/>
> </path>
> <cp>${project.class.path}</cp>
> <suitefile>${basedir}/testng.xml</suitefile>
> </configuration>
> <goals>
> <goal>testsuite</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> ...
> /**
> * @parameter expression="whatever"
> * @required
> */
> private String cp;
>
> public void execute()
> throws MojoExecutionException
> {
> getLog().info("classpath: " + cp);
> String classpath = System.getProperty("java.class.path");
> getLog().info("old classpath: " + classpath);
>
>
> And that told me that ${project.class.path} was undefined. So, one question is how do I pass the path along to the plugin?
>
> But the big question is, how do I specify that I want this plugin to be run with the maven.test.classpath?
>
> Thanks,
>
> Monty
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org