I am totally new to Maven. I Have a maven project(selenium project) that uses TestNG annotations. That means I do not have main method in entire project. I want to create a single fat JAR file with mvn package
. I have gone through few articles for mvn package but could not find any relevant stuff. How can we achieve this for the projects having no main methods.
EDIT
ON checking some more articles, I added below Class with main method as follow
public class MainTest
{
public static void main(String[] args)
{
TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
testng.setTestClasses(new Class[] { AnnotationTest.class });
testng.addListener(tla);
testng.run();
}
}
Where AnnotationTest is a class where all the annotations are used.
When I run generated *one-jar.jar file from command line, I get ClassNotFoundException:AnnotationTest
. Since it is maven project my test.class files are in /target/test-classes. How do I make it available in main method.