jQuery in Action, 3rd edition
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
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ClassNotFound Exception -testng exception" Watch "ClassNotFound Exception -testng exception" New topic

ClassNotFound Exception -testng exception

chandramouli mahadevan

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

Joined: May 14, 2008
Posts: 5852

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
I agree. Here's the link: http://aspose.com/file-tools
subject: ClassNotFound Exception -testng exception
It's not a secret anymore!