Maven project cucumber test builded but result is 0 - maven

When i use this command in terminal mvn test -Dcucumberoptions="--tags #Smoke my test result is 0 all the time. Here is my pom, test runner and feature classes;
pom.xml
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<aspectj.version>1.8.10</aspectj.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.0.0-rc-2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.qameta.allure/allure-junit5 -->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-junit5</artifactId>
<version>2.13.6</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160212</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.rest-assured/json-schema-validator -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>json-schema-validator</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<includes>
**/TestRunner*.java
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>
TestRunner class for cucumber options
package cucumberOptions;
import io.cucumber.junit.Cucumber;
import io.cucumber.junit.CucumberOptions;
import org.junit.runner.RunWith;
#RunWith(Cucumber.class)
#CucumberOptions(
features = "src/test/java/features",
glue = {"Steps"}
)
public class TestRunner {
}
.feature file
#Smoke
Scenario: 5SH Share Privately
When I send share privately api
Then response share status code should be 201
And last my result
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< Automation:Automation >-----------------
[INFO] Building LifeboxAutomation 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Automation ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 7 resources
[INFO] Finished at: 2022-09-15T13:08:38+03:00
[INFO] ------------------------------------------------------------------------
mtc BackendApi mvn test -Dcucumberoptions="--tags #Smoke" in pwsh at 13:08:38
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< Automation:LifeboxAutomation >-----------------
[INFO] Building Automation 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Automation ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 7 resources
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # Automation ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # Automation ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # Automation ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) # Automation ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.056 s
[INFO] Finished at: 2022-09-15T13:20:17+03:00
[INFO] ------------------------------------------------------------------------
Thank you for your advice for now

Surefire normally automatically selects which test-framework provider to use based on the version of TestNG/JUnit present in your project's classpath.
You have both JUnit 5 and JUnit 4 on your classpath, so Surefire will pick JUnit 5 to run all tests. However you didn't include the JUnit Vintage engine so JUnit 5 will not execute JUnit 4 tests.
You're probably better of switching to JUnit 5 entirely though. Have a look at the cucumber-java-skeleton for that.

Related

"mvn test" runs testng instead of Junit

When I run "mvn test" no tests are run and in the report I see that testng was somehow invoked - how is this possible ?
Ultimately mvn does not run any test.
Could someone help ? I dont have any testng library in the code. Maybe pom is incorrect or something is missing ?
Ultimately mvn does not run any test.
Could someone help ? I dont have any testng library in the code. Maybe pom is incorrect or something is missing ?
After running "mvn test" it invokes test ng:
Running cucumber.Options.TestRunner
Configuring TestNG with: org.apache.maven.surefire.testng.conf"
My pom looks like this:
pom.xml
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<properties>
</properties>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>6.9.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>6.9.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured -->
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>4.3.3</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
</dependencies>
</project>
When I run mvn test command I get
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building APIframwork 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # APIframwork ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Test\eclipse-workspace\APIframwork\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # APIframwork ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # APIframwork ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Test\eclipse-workspace\APIframwork\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # APIframwork ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # APIframwork ---
[INFO] Surefire report directory: C:\Users\Test\eclipse-workspace\APIframwork\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running cucumber.Options.TestRunner
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator#7006c658
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.506 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.381 s
[INFO] Finished at: 2021-10-13T15:12:56+02:00
[INFO] Final Memory: 15M/180M
[INFO] ------------------------------------------------------------------------```

Maven compiles old servlet dependency

For some reason Maven is compiling old servlet dependency instead of the new one. I've tried to clean up cache using:
mvn dependency:purge-local-repository -DreResolve=false
and
mvn dependency:resolve
And that's what logs gave me:
[INFO]
[INFO] --- maven-dependency-plugin:2.8:resolve (default-cli) # examproject ---
[INFO]
[INFO] The following files have been resolved:
[INFO] com.google.cloud:google-cloud-core-http:jar:1.84.0:compile
[INFO] com.google.cloud.datastore:datastore-v1-proto-client:jar:1.6.0:compile
[INFO] org.threeten:threetenbp:jar:1.3.3:compile
[INFO] com.google.protobuf:protobuf-java:jar:3.7.1:compile
[INFO] io.grpc:grpc-core:jar:1.21.0:compile
[INFO] com.google.appengine.tools:appengine-gcs-client:jar:0.7:compile
[INFO] joda-time:joda-time:jar:2.3:compile
[INFO] javax.transaction:transaction-api:jar:1.1:compile
[INFO] com.google.api.grpc:proto-google-common-protos:jar:1.16.0:compile
[INFO] jstl:jstl:jar:1.2:compile
[INFO] com.google.oauth-client:google-oauth-client-appengine:jar:1.30.1:compile
[INFO] com.fasterxml.jackson.core:jackson-core:jar:2.9.9:compile
[INFO] com.google.j2objc:j2objc-annotations:jar:1.3:compile
[INFO] org.codehaus.mojo:animal-sniffer-annotations:jar:1.17:compile
[INFO] io.grpc:grpc-context:jar:1.19.0:compile
[INFO] com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] com.google.api:gax-httpjson:jar:0.64.1:compile
[INFO] javax.annotation:javax.annotation-api:jar:1.3.2:compile
[INFO] com.google.appengine:appengine-api-1.0-sdk:jar:1.9.76:compile
[INFO] com.google.http-client:google-http-client-jackson:jar:1.20.0:compile
[INFO] io.opencensus:opencensus-contrib-grpc-metrics:jar:0.21.0:compile
[INFO] org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] com.google.code.gson:gson:jar:2.8.5:provided
[INFO] com.google.api.grpc:proto-google-iam-v1:jar:0.12.0:compile
[INFO] com.google.auth:google-auth-library-oauth2-http:jar:0.16.2:compile
[INFO] commons-logging:commons-logging:jar:1.2:compile
[INFO] com.google.cloud:google-cloud-datastore:jar:1.84.0:compile
[INFO] com.google.errorprone:error_prone_annotations:jar:2.3.2:compile
[INFO] com.google.http-client:google-http-client:jar:1.31.0:compile
[INFO] commons-codec:commons-codec:jar:1.11:compile
[INFO] com.google.http-client:google-http-client-jackson2:jar:1.31.0:compile
[INFO] com.google.code.findbugs:jsr305:jar:3.0.2:compile
[INFO] net.spy:spymemcached:jar:2.12.3:compile
[INFO] com.google.api:api-common:jar:1.8.1:compile
[INFO] com.google.guava:guava:jar:19.0:compile
[INFO] io.opencensus:opencensus-contrib-http-util:jar:0.21.0:compile
[INFO] com.google.http-client:google-http-client-protobuf:jar:1.20.0:compile
[INFO] com.google.oauth-client:google-oauth-client-servlet:jar:1.30.1:compile
[INFO] io.opencensus:opencensus-api:jar:0.21.0:compile
[INFO] com.google.api-client:google-api-client-servlet:jar:1.30.2:compile
[INFO] com.google.apis:google-api-services-storage:jar:v1-rev108-1.22.0:compile
[INFO] com.google.api.grpc:proto-google-cloud-datastore-v1:jar:0.67.0:compile
[INFO] com.google.http-client:google-http-client-appengine:jar:1.30.1:compile
[INFO] javax.servlet.jsp:javax.servlet.jsp-api:jar:2.3.1:provided
[INFO] io.grpc:grpc-api:jar:1.21.0:compile
[INFO] com.google.oauth-client:google-oauth-client:jar:1.22.0:compile
[INFO] org.apache.httpcomponents:httpclient:jar:4.5.9:compile
[INFO] com.google.cloud:google-cloud-core:jar:1.84.0:compile
[INFO] com.google.api-client:google-api-client-appengine:jar:1.30.2:compile
[INFO] org.apache.httpcomponents:httpcore:jar:4.4.11:compile
[INFO] com.google.protobuf:protobuf-java-util:jar:3.7.1:compile
[INFO] javax.servlet:javax.servlet-api:jar:3.1.0:provided
[INFO] com.google.api:gax:jar:1.47.1:compile
[INFO] com.google.auth:google-auth-library-credentials:jar:0.16.2:compile
[INFO] com.google.android:annotations:jar:4.1.1.4:compile
[INFO] junit:junit:jar:4.12:test
[INFO] javax.jdo:jdo2-api:jar:2.3-eb:compile
[INFO] org.slf4j:slf4j-api:jar:1.7.25:compile
[INFO] javax.servlet:servlet-api:jar:2.5:compile
[INFO] com.googlecode.objectify:objectify:jar:6.0.4:compile
[INFO] org.codehaus.jackson:jackson-core-asl:jar:1.9.11:compile
[INFO] com.google.api-client:google-api-client:jar:1.22.0:compile
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 48.139 s
[INFO] Finished at: 2019-08-12T10:51:40+02:00
[INFO] ------------------------------------------------------------------------
As you can see 3.1.0 is provided, but for some reason 2.5 is the one compiled. This is my POM, it is mostly pre-compiled and I've added few dependencies:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>
<packaging>war</packaging>
<version>0.1.0-SNAPSHOT</version>
<groupId>examproject</groupId>
<artifactId>examproject</artifactId>
<properties>
<appengine.maven.plugin.version>2.1.0</appengine.maven.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-bom</artifactId>
<version>0.102.0-alpha</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-gcs-client</artifactId>
<version>0.7</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
<scope>provided</scope>
</dependency>
<!-- Compile/runtime dependencies -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.76</version>
</dependency>
<dependency>
<groupId>com.googlecode.objectify</groupId>
<artifactId>objectify</artifactId>
<version>6.0.4</version>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<!-- for hot reload of the web application -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.maven.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<!-- appengine-maven-plugin requires Maven 3.5.0 -->
<requireMavenVersion>
<version>3.5.0</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
In order to do a couple of things (Using getPart method and something else) I need 3.1.0 servlet.
UPDATE:
If I try to delete C:\Users\Gabriel.m2\repository\javax\servlet\servlet-api, It recreates the folder after I update the project. For some reason Maven is clearly using 2.5 servlet instead of 3.1.0 and I can't understand why.
This is the answer of Gabriel Costache, which I copy/pasted from the question:
I manged to solve it, I'm posting what I've done if someone will ever need it.
Basically, appengine-gcs-client artifact compiles by his own servlet 2.5.
If you have a similar issue, run
mvn dependency:tree
and find from where your dependency is compiled, than add an exclusion tag just like this
<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-gcs-client</artifactId>
<version>0.7</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>

[Cucumber][JVM][Maven]Tests dosen't run from command line through maven

I am running tests using java, cucumber with Maven.
I am using Eclipse IDE. Also the pom.xml has cucumber dependencies.
I am running tests in two ways.
From Eclipse IDE: I run tests as Junit tests and the test results are successful.
2: From command promt: My test failed and below is the result.
Here is the Pom.xml:
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>CCIRA_Test_Auto</groupId>
<artifactId>CCIRA_Test_Auto</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<name>CCIRA_Test_Auto</name>
<properties>
<cucumber.version>1.2.0</cucumber.version>
<picocontainer.version>2.15</picocontainer.version>
</properties>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.44.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.11-beta3</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.8.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
My Runner Test:
package ccira.helpers;
import org.junit.runner.RunWith;
import org.testng.annotations.Test;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
#RunWith(Cucumber.class)
#CucumberOptions(
features = "C:/Users/rah/Documents/workspace/CCIRA_auto/src/ressouces/features",
tags = {"#Personne"},
glue={"ccira.stepDefinitions"},
plugin ={
"pretty",
"html:results/cucumber",
"json:results/cucumber.json",
"junit:results/cucumber.xml",
}
)
public class RunnerTest {
}
My output console :
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building CCIRA_Test_Auto 0.0.1
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact xml-apis:xml-apis:jar:2.0.2 has been relocated to xml-apis:xml-apis:jar:1.0.b2
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # CCIRA_Test_Auto ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\rah\Documents\workspace\CCIRA_Test_Auto\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # CCIRA_Test_Auto ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # CCIRA_Test_Auto ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\rah\Documents\workspace\CCIRA_Test_Auto\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # CCIRA_Test_Auto ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # CCIRA_Test_Auto ---
[INFO] Surefire report directory: C:\Users\rah\Documents\workspace\CCIRA_Test_Auto\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.051s
[INFO] Finished at: Mon Dec 05 09:30:10 GMT 2016
[INFO] Final Memory: 7M/62M
[INFO] ------------------------------------------------------------------------
The dependency
org.slf4j.impl.StaticLoggerBinder
is not defined in your pom.xml file. However it is defined on your build path in your Eclipse project. Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem.
I would add a dependency in your pom.xml, perhaps something like this:
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-simple -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.21</version>
</dependency>
EDIT
A less good but viable alternative is to utilize the Surefire plugin's additionalClasspathElements element "to add custom resources/JARs to your classpath. This will be treated as an absolute file system path, so you may want use ${basedir} or another property combined with a relative path. Note that additional classpath elements are added to the end of the classpath, so you cannot use these to override project dependencies or resources."
I said less good because it is better to track as dependencies in your pom.xml where if you update one dependency to a later version you can see the other dependencies that also have to be updated. You might overlook jars specified down in the surefire plugin.
Try to run using the below command from command prompt
mvn clean test -Dcucumber.options="src/resources/features --tags ##Personne"

junit and hamcrest declaration

I am using junit at 4.10 and declared hamcrest-core at 1.3 and hamcrest-library at 1.3. My question is are hamcrest-library and hamcrest-core embedded in junit 4.10. what about junit 4.11?
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
If you browse to search.maven.org you can search for artifacts and see their dependencies. If you are using Eclipse wit the Maven plugin, you can also click Dependency Hierarchy in the POM editor.
Looking on the Maven website you can see that JUnit 4.11 depends on Hamcrest 1.3:
<dependencies>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
Hamcrest library you have to add yourself.
JUnit 4.10 & JUnit 4.11 (as depicted below):
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
... ship with the hamcrest-core 1.1 and 1.3 respectively. You can see this for yourself by leveraging the dependency plugin's tree goal (running mvn dependency:tree):
$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building testng 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) # testng ---
[INFO] testng:testng:jar:1.0-SNAPSHOT
[INFO] \- junit:junit:jar:4.10:test
[INFO] \- org.hamcrest:hamcrest-core:jar:1.1:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.483s
[INFO] Finished at: Fri Mar 29 12:07:22 MDT 2013
[INFO] Final Memory: 5M/81M
[INFO] ------------------------------------------------------------------------
As silly as this sounds, you need to include the appropriate hamcrest-library artefact to take advantage of the Hamcrest Matchers. Hopefully this helps...

mvn compiler:compile works, mvn compile not

I have a project with a maven pom.xml
<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>Minimal-J</groupId>
<artifactId>Minimal-J</artifactId>
<version>0.1-SNAPSHOT</version>
<name>Minimal-J</name>
<dependencies>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.8.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>10.8.2.2</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<version>6.7.6</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.miglayout</groupId>
<artifactId>miglayout</artifactId>
<version>3.7.4</version>
</dependency>
<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
if I execute
mvn compiler:compile
all 189 of my java classes are compiled
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Minimal-J 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-compiler-plugin:2.4:compile (default-cli) # Minimal-J ---
[INFO] Compiling 189 source files to C:\projects\open-ech\workspace\minimal-j\MinimalJ\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.386s
[INFO] Finished at: Fri May 11 11:50:54 CEST 2012
[INFO] Final Memory: 13M/37M
[INFO] ------------------------------------------------------------------------
if I simply type
mvn compile
Nothing seems to be done:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Minimal-J 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.120s
[INFO] Finished at: Fri May 11 11:53:36 CEST 2012
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------
In a other project everything works fine.
Where could I possibly have configured something wrong to trigger this behaviour?
It's because of pom packaging. By invoking mvn compiler:compile you run compile goal outside Maven's default lifecycle and that basically compile sources in src/main/java. And by mvn compile you run lifecycle up to compile phase and the actual goals executed in every single phase depend on project's packaging type then. pom-type project does nothing in compile phase, because - in fact - there is nothing to compile with just POM.
I suppose your intention was to have jar packaging and changing that should help.

Resources