Answer the question
In order to leave comments, you need to log in
How to build with maven ONLY tests?
I write tests on selenide, it's like selenium. The fact is that when I build a project using maven, a jar appears, and at startup it says no manifest. I have not copied this manifest anywhere (I know that idea had such a bug).
project structure:
and in each file my main class ( RunCucunberTest ) Cannot resolve.
And this is pom.xml just in case, what I commented out did not help
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>cucumber_project</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-bom</artifactId>
<version>7.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.8.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- cucumber -->
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>7.0.0-RC1</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.0.0-RC1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.4</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>io.cucumber</groupId>-->
<!-- <artifactId>cucumber-junit-platform-engine</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<!-- junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<!-- selenide -->
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>5.25.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<includes>
<include>**/RunCucumberTest**.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<descriptors>
<descriptor>src/assembly/descriptor.xml</descriptor>
</descriptors>
<!---->
<!-- <archive>-->
<!-- <manifest>-->
<!-- <mainClass>-->
<!-- test.java.RunCucunberTest-->
<!-- </mainClass>-->
<!-- </manifest>-->
<!-- </archive>-->
<!---->
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Answer the question
In order to leave comments, you need to log in
First. what catches the eye <pluginManagement>
. Your plugins inside this tag. This tag allows you to manage the specified plugins inside modules, but if you want them to be applied to the current project, then pull the plugins from this plugin.
In the configs of the maven-assembly-plugin plugin, write this and specify your class
<archive>
<manifest>
<mainClass>com.example.Main</mainClass>
</manifest>
</archive>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question