wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes ClassNotFound Exception -testng exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ClassNotFound Exception -testng exception" Watch "ClassNotFound Exception -testng exception" New topic
Author

ClassNotFound Exception -testng exception

chandramouli mahadevan
Greenhorn

Joined: Oct 08, 2012
Posts: 1
I am trying to run the testng.xml using pom.xml but the class that is inside this testng.xml refers to another class that isn't in pom.xml. I have added it to the classpath and added the necessary class as a dependency too. However, I still get a ClassNotFoundException that still remains when I do mvn install.
Let me just explain what i want as the output,Suppose there are 3 maven modules A,B and C.Now i am running the pom.xml of module 3 which consists of a testng.xml.This testng.xml wants to run a class of module 1 or 2 as per the user's wish(Its user interactive,so the testng changes accordingly).Now i have added the dependencies of 1 and 2 in 3. One more thing,i am running the pom.xml of module3 by runtime java command exec.
testng.xml looks like this <class name="com.org.test.mod1"></class>.And I am running Process p1=Runtime.getRuntime().exec("mvn -e install");
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

I would have to see the pom.xml for module C, and the mvn command output.

You mention using Runtime.exec() to run mvn. Does the build work correctly if you run mvn from a command prompt?

One other thought - have you tried adding the -U option to the mvn command? That option will print out the classpath used during testing, that might give you a clue as to what is going on.


JBoss In Action
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ClassNotFound Exception -testng exception