I've been Googling for days trying to figure out how to do this, if anybody has done this before I would greatly appreciate the help.
I have an automation test project I've created in IntelliJ that automates a user interacting with a Web Application.
I'd like to put that automated test (created in Java, using Selenium and TestNG) into an executable jar file that others can run by double-clicking the jar file.
Every time I attempt to create a jar file by navigating to Project Structure -> Artifact -> + -> Jar -> From modules with dependencies, it ends up creating a jar that claims it,
"Could not find or load the main class <package.MainClass> "
when I attempt to run it with the following command:
java -jar MyProject.jar <Manifest Path>
Any idea why I continually get this error, or have a way to do this successfully?
Also, here is my pom.xml:
<groupId>TestAutomation</groupId>
<artifactId>TestAutomation</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.test.automation.Executable</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.39.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.40.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.1.1</version>
<scope>test</scope>
</dependency>
</dependencies>