I am using Geb Spock maven with athaydes reports. When I integrated athaydes reports I am able to execute test case from Intellij IDE and its giving proper reports as well. However when I do execute it from command it gives me error related to missing dependency.
Strange part is that when I follow below sequence of execution steps Reports are successfully getting generated
Scenario 1:
- mvn clean
- Now, execute test case from Intellij. (Reports are successfully generated)
- Now, execute same test case from command line by using below command:
$ mvn -Dtest=spec/sprintOne/TC001_SMO_Scenario_Spec test
Reports are sucesfully generated
Scenario 2:
- mvn clean
Now, execute same test case from command line by using below command:
$ mvn -Dtest=spec/sprintOne/TC001_SMO_Scenario_Spec test
Giving below error message:
C:\DurgeshProjectWork\Workspace\IdeaProjects\bdd_geb_spock>mvn -Dtest=spec/sprintOne/TC001_SMO_Scenario_Spec test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building bdd_geb_spock 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ bdd_geb_spock ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ bdd_geb_spock ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ bdd_geb_spock ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 12 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ bdd_geb_spock ---
[INFO] No sources to compile
[INFO]
[INFO] --- gmaven-plugin:1.4:testCompile (default) @ bdd_geb_spock ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.585 s
[INFO] Finished at: 2018-03-27T13:48:16+05:30
[INFO] Final Memory: 20M/127M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.gmaven:gmaven-plugin:1.4:testCompile (default) on project bdd_geb_spock: Execution default of goal org.codehaus.gmaven:gmaven-plugin:1.4:testCompile failed: A required class was missing while executing org.codehaus.gmaven:g
maven-plugin:1.4:testCompile: Unable to load class org.spockframework.runtime.ErrorCollector due to missing dependency org/junit/runners/model/MultipleFailureException
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.codehaus.gmaven:gmaven-plugin:1.4
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/Durgesh/.m2/repository/org/codehaus/gmaven/gmaven-plugin/1.4/gmaven-plugin-1.4.jar
[ERROR] urls[1] = file:/C:/Users/Durgesh/.m2/repository/org/codehaus/gmaven/runtime/gmaven-runtime-1.8/1.4/gmaven-runtime-1.8-1.4.jar
[ERROR] urls[2] = file:/C:/Users/Durgesh/.m2/repository/org/codehaus/gmaven/feature/gmaven-feature-support/1.4/gmaven-feature-support-1.4.jar
[ERROR] urls[3] = file:/C:/Users/Durgesh/.m2/repository/org/apache/ant/ant/1.8.2/ant-1.8.2.jar
[ERROR] urls[4] = file:/C:/Users/Durgesh/.m2/repository/org/apache/ant/ant-launcher/1.8.2/ant-launcher-1.8.2.jar
[ERROR] urls[5] = file:/C:/Users/Durgesh/.m2/repository/jline/jline/0.9.94/jline-0.9.94.jar
[ERROR] urls[6] = file:/C:/Users/Durgesh/.m2/repository/org/codehaus/groovy/groovy-all/2.4.14/groovy-all-2.4.14.jar
[ERROR] urls[7] = file:/C:/Users/Durgesh/.m2/repository/org/spockframework/spock-core/1.1-groovy-2.4/spock-core-1.1-groovy-2.4.jar
[ERROR] urls[8] = file:/C:/Users/Durgesh/.m2/repository/junit/junit/3.8.2/junit-3.8.2.jar
[ERROR] urls[9] = file:/C:/Users/Durgesh/.m2/repository/org/codehaus/gmaven/runtime/gmaven-runtime-api/1.4/gmaven-runtime-api-1.4.jar
[ERROR] urls[10] = file:/C:/Users/Durgesh/.m2/repository/org/codehaus/gmaven/feature/gmaven-feature-api/1.4/gmaven-feature-api-1.4.jar
[ERROR] urls[11] = file:/C:/Users/Durgesh/.m2/repository/org/codehaus/gmaven/runtime/gmaven-runtime-loader/1.4/gmaven-runtime-loader-1.4.jar
[ERROR] urls[12] = file:/C:/Users/Durgesh/.m2/repository/org/codehaus/gmaven/runtime/gmaven-runtime-support/1.4/gmaven-runtime-support-1.4.jar
[ERROR] urls[13] = file:/C:/Users/Durgesh/.m2/repository/org/sonatype/gshell/gshell-io/2.4/gshell-io-2.4.jar
[ERROR] urls[14] = file:/C:/Users/Durgesh/.m2/repository/org/codehaus/plexus/plexus-utils/3.0/plexus-utils-3.0.jar
[ERROR] urls[15] = file:/C:/Users/Durgesh/.m2/repository/com/thoughtworks/qdox/qdox/1.12/qdox-1.12.jar
[ERROR] urls[16] = file:/C:/Users/Durgesh/.m2/repository/org/apache/maven/shared/file-management/1.2.1/file-management-1.2.1.jar
[ERROR] urls[17] = file:/C:/Users/Durgesh/.m2/repository/org/apache/maven/shared/maven-shared-io/1.1/maven-shared-io-1.1.jar
[ERROR] urls[18] = file:/C:/Users/Durgesh/.m2/repository/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar
[ERROR] urls[19] = file:/C:/Users/Durgesh/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar
[ERROR] urls[20] = file:/C:/Users/Durgesh/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar
[ERROR] urls[21] = file:/C:/Users/Durgesh/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar
[ERROR] urls[22] = file:/C:/Users/Durgesh/.m2/repository/org/apache/maven/reporting/maven-reporting-impl/2.0.4.1/maven-reporting-impl-2.0.4.1.jar
[ERROR] urls[23] = file:/C:/Users/Durgesh/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.1/plexus-interpolation-1.1.jar
[ERROR] urls[24] = file:/C:/Users/Durgesh/.m2/repository/commons-validator/commons-validator/1.2.0/commons-validator-1.2.0.jar
[ERROR] urls[25] = file:/C:/Users/Durgesh/.m2/repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar
[ERROR] urls[26] = file:/C:/Users/Durgesh/.m2/repository/commons-digester/commons-digester/1.6/commons-digester-1.6.jar
[ERROR] urls[27] = file:/C:/Users/Durgesh/.m2/repository/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar
[ERROR] urls[28] = file:/C:/Users/Durgesh/.m2/repository/oro/oro/2.0.8/oro-2.0.8.jar
[ERROR] urls[29] = file:/C:/Users/Durgesh/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar
[ERROR] urls[30] = file:/C:/Users/Durgesh/.m2/repository/org/apache/maven/doxia/doxia-core/1.0-alpha-10/doxia-core-1.0-alpha-10.jar
[ERROR] urls[31] = file:/C:/Users/Durgesh/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-10/doxia-sink-api-1.0-alpha-10.jar
[ERROR] urls[32] = file:/C:/Users/Durgesh/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.4/maven-reporting-api-2.0.4.jar
[ERROR] urls[33] = file:/C:/Users/Durgesh/.m2/repository/org/apache/maven/doxia/doxia-site-renderer/1.0-alpha-10/doxia-site-renderer-1.0-alpha-10.jar
[ERROR] urls[34] = file:/C:/Users/Durgesh/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-7/plexus-i18n-1.0-beta-7.jar
[ERROR] urls[35] = file:/C:/Users/Durgesh/.m2/repository/org/codehaus/plexus/plexus-velocity/1.1.7/plexus-velocity-1.1.7.jar
[ERROR] urls[36] = file:/C:/Users/Durgesh/.m2/repository/org/apache/velocity/velocity/1.5/velocity-1.5.jar
[ERROR] urls[37] = file:/C:/Users/Durgesh/.m2/repository/org/apache/maven/doxia/doxia-decoration-model/1.0-alpha-10/doxia-decoration-model-1.0-alpha-10.jar
[ERROR] urls[38] = file:/C:/Users/Durgesh/.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar
[ERROR] urls[39] = file:/C:/Users/Durgesh/.m2/repository/org/apache/maven/doxia/doxia-module-apt/1.0-alpha-10/doxia-module-apt-1.0-alpha-10.jar
[ERROR] urls[40] = file:/C:/Users/Durgesh/.m2/repository/org/apache/maven/doxia/doxia-module-fml/1.0-alpha-10/doxia-module-fml-1.0-alpha-10.jar
[ERROR] urls[41] = file:/C:/Users/Durgesh/.m2/repository/org/apache/maven/doxia/doxia-module-xdoc/1.0-alpha-10/doxia-module-xdoc-1.0-alpha-10.jar
[ERROR] urls[42] = file:/C:/Users/Durgesh/.m2/repository/org/apache/maven/doxia/doxia-module-xhtml/1.0-alpha-10/doxia-module-xhtml-1.0-alpha-10.jar
[ERROR] urls[43] = file:/C:/Users/Durgesh/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar
[ERROR] urls[44] = file:/C:/Users/Durgesh/.m2/repository/org/sonatype/gossip/gossip/1.2/gossip-1.2.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR]
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
Please find attached pom.xml:
<?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>net.wu.webapp</groupId>
<artifactId>bdd_geb_spock</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<skipITTests>false</skipITTests>
<geb.version>2.1</geb.version>
<selenium.version>3.6.0</selenium.version>
<groovy.version>2.4.14</groovy.version>
<spock.version>1.1-groovy-2.4</spock.version>
<gson.version>2.8.2</gson.version>
<httpclient.version>4.3.4</httpclient.version>
<httpcore.version>4.3.2</httpcore.version>
<surefire.plugin.version>2.21.0</surefire.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<serenity.version>1.9.2</serenity.version>
<serenity.maven.version>1.9.2</serenity.maven.version>
<serenity.cucumber.version>1.9.3</serenity.cucumber.version>
<tags></tags>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${spock.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.gebish</groupId>
<artifactId>geb-spock</artifactId>
<version>${geb.version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.gebish/geb-core -->
<dependency>
<groupId>org.gebish</groupId>
<artifactId>geb-core</artifactId>
<version>${geb.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
<!--<scope>test</scope>-->
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<!--Dependencies related to GEB SPOCK reporting-->
<dependency>
<groupId>com.athaydes</groupId>
<artifactId>spock-reports</artifactId>
<version>1.4.0</version>
<scope>test</scope>
<!-- this avoids affecting your version of Groovy/Spock -->
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
</dependency>
<!-- // if you don't already have slf4j-api and an implementation of it in the classpath, add this! -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.13</version>
<scope>test</scope>
</dependency>
<!-- Serenity related dependencies -->
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>${serenity.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.plugin.version}</version>
<configuration>
<skipTests>${skipITTests}</skipTests>
<includes>
<include>*Spec.*</include>
</includes>
<systemPropertyVariables>
<geb.build.reportsDir>target/test-reports/geb</geb.build.reportsDir>
<!--<geb.build.reportsDir>target/reports</geb.build.reportsDir>-->
</systemPropertyVariables>
</configuration>
</plugin>
<!-- Maven gmaven plugin-->
<plugin>
<!--<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>-->
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<!--<version>1.4</version>-->
<version>1.4</version>
<configuration>
<providerSelection>1.8</providerSelection>
<source/>
</configuration>
<executions>
<execution>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-1.8</artifactId>
<!--<version>1.4</version>-->
<version>1.4</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${spock.version}</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
<!-- Maven compiler plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- Serenity Plugin -->
<plugin>
<groupId>net.serenity-bdd.maven.plugins</groupId>
<artifactId>serenity-maven-plugin</artifactId>
<version>${serenity.maven.version}</version>
<dependencies>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>${serenity.version}</version>
</dependency>
</dependencies>
<configuration>
<tags>${tags}</tags>
</configuration>
<executions>
<execution>
<id>serenity-reports</id>
<phase>post-integration-test</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Sonar Maven Plugin -->
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.4.0.905</version>
</plugin>
</plugins>
</build>
</project>
Please help me to execute test cases from command line as its successfully getting executed by Intellij.
Thanks.
GMaven 2.x should not be used for Groovy compilation anymore according to its own web site:
So I updated your POM a bit - I wanted to fix a few more things, but didn't - by just adding Groovy Eclipse support to the Maven Compiler:
Now
mvn clean testworks:The full POM - is here: