I have a Selenium TestNG project created with maven. ``
There is no main class for this prject
Using TestNg.xml file and the same is configured in pom.xml file.
Ran 'maven test' from eclispe and the test runs successfully based on the classes defined in testng.xml. no issues here
Tried the same from command prompt using mvn test from the project folder and it ran succesfully. no issues here too.
My requirement : Now i want to package this project either to executable jar or are there are any option to make a executable file so that i can schedule the run using a batch file.
To do this I ran the 'mvn package' command and it generated the jar file in the target folder. Now when i try to run this as java -jar myproj-0.0.1-SNAPSHOT.jar i get the message as "no main manifest attribute, in myproj-0.0.1-SNAPSHOT.jar". This is expected behavior since there is no main class in my case.
So i created a main class with just one line to print "text" and added the mainClass below entry in pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<archive>
<manifest>
<mainClass>mainPackage.MainOne</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
Then i ran mvn package and it generated the new jar. Then went to target folder of my project and ran the command as java -jar myProj.jar mainPackage.MainOne, it ran and just printed "text". MY TestNG tests did not run. It just ran main class :(.. What should i do?