I have 3 tests stored under a package that all take advantage of the JUnit @Test annotation. I do not have a main class in the project. Naturally, I can go Run As > Maven Test and all 3 tests will get executed.
I created a Jar executable file using the the Install command, but when I try to run the Jar file I get the message - "No main manifest attribute" message.
What is the solution for dealing with this in Maven?
I know that in Gradle, you do not need a main class to run the Jar executable.
Alternatively, would I need to create a main class containing a main method like this:
public static void main(String[] args){
List tests = new ArrayList();
tests.add(TestOne.class);
tests.add(TestTwo.class);
for (Class test : tests){
runTests(test);
}
}
private static void runTests(Class test){
Result result = JUnitCore.runClasses(test);
for (Failure failure : result.getFailures()){
System.out.println(failure.toString());
}
}
That kind of feels counter-intuitive to me however.