« Return to Thread: newbie question about specifying testClassesDirectory

Re: newbie question about specifying testClassesDirectory

by thebad :: Rate this Message:

Reply to Author | View in Thread

On 02/07/09 21:26, Anders Hammar wrote:
> The surefire plugin forks by default. Possibly there is a bug in the
> surefire plugin you're using (and you can't upgrade to the newest one
> as it requires a newer Maven version than you're using, hence my
> upgrade recommendation). I'm thinking that the class path isn't
> correctly passed when forking. You could try turn off the forking by
> the forkMode configuration:
> http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#forkMode
>    

Hi Anders,

Adding the following to the pom.xml allows the tests to run through
correctly.

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>never</forkMode>
</configuration>
</plugin>
</plugins>
...

</project>

Thanks!!!

Tom




> /Anders
>
> On Thu, Jul 2, 2009 at 22:07, Tom H<tom@...>  wrote:
>    
>> Hi,
>>
>> Thanks for the reply, I've some comments in-lined below;
>>
>>
>> On 02/07/09 20:09, Anders Hammar wrote:
>>      
>>> Hi,
>>>
>>> As a starter, you should probably upgrade Maven as version 2.0.4 is
>>> VERY old. You can tell from your attached output that there are newer
>>> surefire plugin versions that can't be used with Maven 2.0.4.
>>>
>>>        
>> I am pretty much stuck with what's in the fedora11 repos, so I am hoping to
>> fix the problem or send in a bug report...
>>
>>      
>>> Regarding your problem: Try running with "-X" (debug) instead of "-e"
>>> and then check the output. Look for the test classpath and verify that
>>> ./target/test-classes/ is included in the path.
>>>
>>>        
>> Just before the ClassNotFoundException it tries to run this;
>>
>> Forking command line: /bin/sh -c "cd
>> /home/tomhodder/eclipse/workspace/simple&&
>> /usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre/bin/java -jar
>> /tmp/surefirebooter4m1yoz.jar /tmp/surefire4m1yoxtmp /tmp/surefire4m1yoytmp"
>> org.apache.maven.surefire.booter.SurefireExecutionException: Unable to
>> create test class 'com.mytutorial.AppTest';
>>
>> the surefire booter jar only contains this;
>> [tomhodder@localhost simple]$ unzip -t /tmp/surefirebooter4m1yoz.jar
>> Archive:  /tmp/surefirebooter4m1yoz.jar
>>     testing: META-INF/MANIFEST.MF     OK
>> No errors detected in compressed data of /tmp/surefirebooter4m1yoz.jar.
>>
>> And the MANIFEST file contains the correct test-classes path....
>>
>> If I strace that fork command it does what looks like find the correct
>> AppTest class, and then gives up;
>>
>> stat("/home/tomhodder/eclipse/workspace/simple/target/test-classes/com/mytutorial/AppTest.class",
>> {st_mode=S_IFREG|0664, st_size=1006, ...}) = 0
>> stat("/home/tomhodder/eclipse/workspace/simple/target/test-classes/com/mytutorial/AppTest.class",
>> {st_mode=S_IFREG|0664, st_size=1006, ...}) = 0
>> ftruncate(9, 69632)                     = 0
>> mmap(NULL, 4096, PROT_READ|PROT_EXEC, MAP_SHARED, 9, 0x10000) =
>> 0x7ff109a66000
>> mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, 9, 0x10000) =
>> 0x7ff109a65000
>> write(2, "org.apache.maven.surefire.booter."...,
>> 500org.apache.maven.surefire.booter.SurefireExecutionException: Unable to
>> create test class 'com.mytutorial.AppTest'; nested exception is
>> java.lang.ClassNotFoundException: com.mytutorial.AppTest not found in
>> gnu.gcj.runtime.SystemClassLoader{urls=[file:/tmp/surefirebooter4m1yoz.jar],
>> parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}; nested
>> exception is org.apache.maven.surefire.testset.TestSetFailedException:
>> Unable to create test class 'com.mytutorial.AppTest'; nested exception i) =
>> 500
>> write(2, "s java.lang.ClassNotFoundExceptio"..., 100s
>> java.lang.ClassNotFoundException: com.mytutorial.AppTest not found in
>> gnu.gcj.runtime.SystemClassL) = 100
>>
>>
>>
>>
>> any ideas on that?
>>
>> Tom
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>>      
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...

 « Return to Thread: newbie question about specifying testClassesDirectory