I am creating an executable jar file for my project and created the MANIFEST.mf
file.
I have changed the location of manifest file to src/main/resources
Although the manifest.mf
file is auto generated by intellij, it is still showing me error with Main-Class attribute as 'cannot resolve class'.
My main class look like this:
package runner;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@CucumberOptions(
strict=true,
monochrome=false,
features = {"src/test/java/features/ALogin.feature",},
glue = {"steps"},
plugin= {
"html:target/site/cucumber-html",
"json:target/cucumber1.json"}
)
public class TestRunner {
public static void main(String[] args){
String[] arguments={"--glue", "steps"};
cucumber.api.cli.Main.main(arguments);
SecurityManager manager = new IgnoreExitCall();
System.setSecurityManager(manager);
try {
cucumber.api.cli.Main.main(arguments);
} catch (SecurityException s) {
System.out.println("Ignore exit");
}
}
}
My MANIFEST.mf
like look like this:
Manifest-Version: 1.0
Main-Class: runner.TestRunner
on hovering over Main-Class, it says cannot resolve class 'runner.TestRunner'.
My pom.xml
looks like this:
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>
runner.TestRunner
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>