Getting an error message "Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.5.2:install (default-install) on project" - maven

Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.5.2:install (default-install) on project iGateVacationServices: Execution default-install of goal org.apache.maven.plugins:maven-install-plugin:2.5.2:install failed: Plugin org.apache.maven.plugins:maven-install-plugin:2.5.2 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-install-plugin:jar:2.5.2 -> org.apache.maven:maven-project:jar:2.2.1 -> org.apache.maven:maven-settings:jar:2.2.1 -> org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 -> junit:junit:jar:3.8.1: Failed to read artifact descriptor for junit:junit:jar:3.8.1: Could not transfer artifact junit:junit:pom:3.8.1 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.112.215] failed: Connection timed out: connect -> [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:
[JENKINS] Archiving D:\Selenium\iGATEVacationService\iGateVacationServices\pom.xml to iGateVacationServices/iGateVacationServices/0.0.1-SNAPSHOT/iGateVacationServices-0.0.1-SNAPSHOT.pom
My test is executing properly but when it comes to print the report it shows the following error in Jenkins.Need a help to understand if I have done any mistakes in adding dependencies or plugins.
I am using JDK1.8, TestNG, Selenium, Maven and Jenkins.
My POM.XML dependencies and Plugins are as follows
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>3.0.0-M1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<type>maven-plugin</type>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
<scope>system</scope>
<systemPath>${basedir}/ojdbc6.jar</systemPath>
</dependency>
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<verbose>true</verbose>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<inherited>true</inherited>
<configuration>
<suitXmlFiles>${suiteFile}</suitXmlFiles>
</configuration>
</plugin>
</plugins>

Related

Jenkins cannot execute Maven command: "An error has occurred while checking scm status. Unable to discover client"

I'm currently getting a new Jenkins server running, going from version 2.128 to 2.222. I have several projects that are all failing with the same error due to a problem communicating with my SCM through Maven. Here is the error:
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # drizzlesizzle ---
[DEBUG] Skipping non-existing directory /var/jenkins_home/workspace/drizzlesizzle-laurenc/target
[DEBUG] Skipping non-existing directory /var/jenkins_home/workspace/drizzlesizzle-laurenc/target/classes
[DEBUG] Skipping non-existing directory /var/jenkins_home/workspace/drizzlesizzle-laurenc/target/test-classes
[DEBUG] Skipping non-existing directory /var/jenkins_home/workspace/drizzlesizzle-laurenc/target/site
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-jackson-versions) # drizzlesizzle ---
[DEBUG] Executing rule: org.apache.maven.plugins.enforcer.RequireSameVersions
[INFO]
[INFO] --- buildnumber-maven-plugin:1.4:create (default) # drizzlesizzle ---
[DEBUG] Verifying there are no local modifications ...
[DEBUG] info
[DEBUG] Command completed in 37ms
[DEBUG] clients -m2147483647 -up4-daemon
[DEBUG] Command completed in 38ms
[DEBUG] Perforce password (P4PASSWD) invalid or unset.
[ERROR] Perforce password (P4PASSWD) invalid or unset.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.578 s
[INFO] Finished at: 2020-04-08T22:05:54+00:00
[INFO] Final Memory: 27M/188M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create (default) on project drizzlesizzle: An error has occurred while checking scm status. Unable to discover client: Perforce password (P4PASSWD) invalid or unset. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:buildnumber-maven-plugin:1.4:create (default) on project drizzlesizzle: An error has occurred while checking scm status.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.jvnet.hudson.maven3.launcher.Maven33Launcher.main(Maven33Launcher.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven33Main.launch(Maven33Main.java:178)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:139)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:70)
at hudson.remoting.UserRequest.perform(UserRequest.java:211)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:369)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.maven.plugin.MojoExecutionException: An error has occurred while checking scm status.
at org.codehaus.mojo.build.CreateMojo.checkForLocalModifications(CreateMojo.java:479)
at org.codehaus.mojo.build.CreateMojo.execute(CreateMojo.java:365)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 31 more
Caused by: org.apache.maven.scm.ScmException: Unable to discover client
at com.perforce.maven.scm.provider.p4.manager.DefaultP4ClientManager.getClient(DefaultP4ClientManager.java:151)
at com.perforce.maven.scm.provider.p4.manager.DefaultP4ClientManager.getClient(DefaultP4ClientManager.java:75)
at com.perforce.maven.scm.provider.p4.P4ScmProvider.login(P4ScmProvider.java:264)
at org.apache.maven.scm.provider.AbstractScmProvider.login(AbstractScmProvider.java:747)
at org.apache.maven.scm.provider.AbstractScmProvider.status(AbstractScmProvider.java:789)
at org.codehaus.mojo.build.CreateMojo.getStatus(CreateMojo.java:544)
at org.codehaus.mojo.build.CreateMojo.checkForLocalModifications(CreateMojo.java:475)
... 34 more
Caused by: org.apache.maven.scm.ScmException: Unable to discover client
at com.perforce.maven.scm.provider.p4.manager.DefaultP4ClientManager.discoverClientName(DefaultP4ClientManager.java:402)
at com.perforce.maven.scm.provider.p4.manager.DefaultP4ClientManager.getClient(DefaultP4ClientManager.java:90)
... 40 more
Caused by: com.perforce.p4java.exception.RequestException: Perforce password (P4PASSWD) invalid or unset.
at com.perforce.p4java.impl.mapbased.server.Server.getClients(Server.java:1003)
at com.perforce.p4java.impl.mapbased.server.Server.getClients(Server.java:969)
at com.perforce.maven.scm.provider.p4.manager.DefaultP4ClientManager.discoverClientName(DefaultP4ClientManager.java:364)
... 41 more
[ERROR]
[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/MojoExecutionException
This happens when I have the Build/Goals and options settings of Jenkins to "-X --update-snapshots clean verify".
I have noticed that all of the projects that fail with this have the same scm tag in their pom.xml. Here is one of those poms:
<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>
<parent>
<groupId>com.sustaining</groupId>
<artifactId>sustaining-parent-pom</artifactId>
<version>1.2-SNAPSHOT</version>
</parent>
<artifactId>drizzlesizzle</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>drizzlesizzle</name>
<properties>
<mock-server.version>3.10.4</mock-server.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<id>create-uber-jar</id>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>com.sustaining.drizzlesizzle.server.DrizzlesizzleStarter</Main-Class>
<Class-Path>.</Class-Path>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>enforce-jackson-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireSameVersions>
<dependencies>
<dependency>com.fasterxml.jackson.core.jackson-annotations</dependency>
<dependency>com.fasterxml.jackson.datatype:jackson-datatype-jsr310</dependency>
</dependencies>
</requireSameVersions>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- project specific -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>com.sustaining.util</groupId>
<artifactId>CommandExecutor</artifactId>
<version>0.0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sustaining.core</groupId>
<artifactId>CoReClient</artifactId>
<version>1.1.0.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>com.sustaining.util</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sustaining.util</groupId>
<artifactId>jar-extractor</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sustaining.util</groupId>
<artifactId>unzipper</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sustaining.can</groupId>
<artifactId>cancommand2</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.sustaining.can</groupId>
<artifactId>CanClient2</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
</dependency>
<!-- Jersey -->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-grizzly2-servlet</artifactId>
</dependency>
<!-- JSON with Jackson -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.5.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.8</version>
</dependency>
<!-- Swagger API docs -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jersey2-jaxrs</artifactId>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-bundle</artifactId>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.meanbean</groupId>
<artifactId>meanbean</artifactId>
<version>2.0.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mock-server</groupId>
<artifactId>mockserver-netty</artifactId>
<version>${mock-server.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>logback-classic</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<description>A Java service that exposes a RESTful interface to talk to tape drives, usually with ITDT.</description>
<scm>
<connection>scm:p4:perforce.domain.com:1666://Sustaining/drizzletizzle-standard-test/drizzlesizzle</connection>
<developerConnection>scm:p4:perforce.domain.com:1666://Sustaining/drizzletizzle-standard-test/drizzlesizzle</developerConnection>
<url>http://perforce.domain.com:8080/#md=d&cd=//Sustaining/hptizzle/&c=ZSb#//Sustaining/drizzletizzle/drizzlesizzle/?ac=83</url>
</scm>
<issueManagement>
<system>JIRA</system>
<url>https://jira.domain.com/projects/SUSDT/issues</url>
</issueManagement>
<ciManagement>
<system>Jenkins</system>
<url>http://works:8888/job/drizzlesizzle/</url>
</ciManagement>
<!-- Jenkins build plugins, for static code analysis -->
<profiles>
<!-- Jenkins by default defines a property BUILD_NUMBER which is used to enable the profile. -->
<profile>
<id>jenkins</id>
<activation>
<property>
<name>env.BUILD_NUMBER</name>
</property>
</activation>
<build>
<plugins>
<!-- JaCoCo coverage -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<!-- Run Checkstyle -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<!-- Run FindBugs -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
</plugin>
<!-- Run PMD and the copy paste detector -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
</plugin>
<!-- Attach Javadocs -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
I have 8 projects that are failing for this error, which all have the same SCM syntax:
<scm>
<connection>scm:p4:perforce.domain.com:1666://Sustaining/drizzletizzle-standard-test/drizzlesizzle</connection>
<developerConnection>scm:p4:perforce.domain.com:1666://Sustaining/drizzletizzle-standard-test/drizzlesizzle</developerConnection>
<url>http://perforce.domain.com:8080/#md=d&cd=//Sustaining/hptizzle/&c=ZSb#//Sustaining/drizzletizzle/drizzlesizzle/?ac=83</url>
</scm>
I have a few projects that are on SVN that are not having this problem. I also have a couple dozen projects that do not use the maven scm plugin option at all, and they can connect to my Perforce server just fine.
I have tried changing the formatting of the connections (changing p4 to perforce, which then failed for a missing password), removing the scm entirely, and adding the buildnumber-maven-plugin to the pom.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<dependencies>
<dependency>
<groupId>com.perforce.p4maven</groupId>
<artifactId>p4maven-provider</artifactId>
<version>${p4maven.version}</version>
</dependency>
</dependencies>
</plugin>
I figured it out. I did not have the Maven Info plugin install in Jenkins. Once installed, all of my projects built without issue.

Compile issue while running maven

Created maven project and imported it to eclipse, while running test from maven using command mvn test, getting below error
Error:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project Moni: Compilation failure -> [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/MojoFailureException
I have tried using mv clean install but still issue exists.
below is my pom.xml:
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>jin</groupId>
<artifactId>Moni</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Moni</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.0.0-alpha-4</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven
defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<fork>true</fork>
<executable>C:\Program Files\Java\jdk1.8.0_172.exe</executable>
<compilerVersion>1.8</compilerVersion>
<source>1.8</source>
<target>1.8</target>
</configuration>
<dependencies>
<!-- <dependency> <groupId>asm</groupId> <artifactId>asm</artifactId>
<version>3.3.1</version> </dependency> -->
</dependencies>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>

Cucmber Feature file execution from Maven CLI

I am trying to execute a cucumber feature file from maven command line and facing the following issue - Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.14.1:test (default-test) on project Maven: No tests were executed!
The command I have used to execute is -
mvn -Dtest -Document.options="src/test/resources/maven_poc/excel_colors.feature:3"
However the step definitions file is executed successfully when executed from maven command prompt.
• mvn -Dtest=excel_color_stepdef test
Screenshot at the link - https://i.stack.imgur.com/MKsd8.jpg
My pom.xml is as below. Anyone who has faced similar issues? Any tips on resolution steps is appreciated.
<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>Cucumber_POC</groupId>
<artifactId>Maven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
</plugins>
</reporting>
<build>
<defaultGoal>install</defaultGoal>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>2.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>2.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
<version>5.1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
</project>
Those don't look like valid maven commands. It's mvn test. And the system property is named cucumber.options. So mvn test -Dcucumber.options="src/test/resources/maven_poc/excel_colors.feature:3"
You should execute the java test class that references the cucumber. Something like:
#ContextConfiguration(loader = SpringBootContextLoader.class, classes = EligibilityApplication.class)
#RunWith(Cucumber.class)
#CucumberOptions(features = "src/test/resources/cucumber/eligibility/listpolicies/ListPolicies.feature", strict = true)
public class ListPoliciesTest {
}
And in the maven command you will use something like:
mvn -Dtest="src/test/java/../ListPoliciesTest.java"

how to generate index.html- allure reporting- testng-maven-selenium webdriver

I am new to allure reporting. I am having selenium testng tests and using maven to run them. After mvn test, a xml file is generated allure-result folder.
Can anyone tell me how to generate index.html file with this. Do i need to add something in pom.xml. Here is my pom.xml :
<properties>
<allure.version>1.4.13</allure.version>
<aspectj.version>1.8.10</aspectj.version>
</properties>
<dependencies>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>2.0-BETA14</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-testng-adaptor</artifactId>
<version>1.5.3</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>test</scope>
</dependency>
<build>
<plugins>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
</argLine>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.10</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<outputDirectory>${basedir}/target/allure-reports/</outputDirectory>
<allureResultsDirectory>${basedir}/target/allure-results</allureResultsDirectory>
</configuration>
</plugin>
</plugins>
</reporting>
I tried running MVN site but that did not work.
Thanks!!
The problem is that you are using old report (Allure 1) together with new adaptor (that is only supported by Allure 2).
You can find the full documentation here https://docs.qameta.io/allure/2.0/#_testng
Also there is working example available https://github.com/allure-examples/allure-testng-example

Unresolveable build extension while resolving grails plugins using maven

I am trying to compile a grails project using maven. I am getting the following error
[INFO] Scanning for projects...
[WARNING] The POM for org.grails.plugins:kickstart-with-bootstrap:jar:1.1.0 is missing, no dependency information available
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.test:temp2:0.1 (/mnt/data/Work/Tutorials/Practice/grails/temp2/pom.xml) has 2 errors
[ERROR] Unresolveable build extension: Plugin org.grails.plugins:kickstart-with-bootstrap:1.1.0 or one of its dependencies could not be resolved: Failure to find org.grails.plugins:kickstart-with-bootstrap:jar:1.1.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 2]
[ERROR] Unknown packaging: grails-app # line 9, column 16
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
The error is such that I am not even able to generate the dependency tree. I am attaching my pom.xml. Could anyone please tell me where I am going wrong.
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>temp2</artifactId>
<packaging>grails-app</packaging>
<version>0.1</version>
<name>temp2</name>
<description>temp2</description>
<properties>
<grails.version>2.4.2</grails.version>
<h2.version>1.3.170</h2.version>
</properties>
<dependencies>
<dependency>
<groupId>org.grails</groupId>
<artifactId>grails-dependencies</artifactId>
<version>${grails.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.grails</groupId>
<artifactId>grails-test</artifactId>
<version>${grails.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.grails</groupId>
<artifactId>grails-plugin-testing</artifactId>
<version>${grails.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>0.7-groovy-2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.grails</groupId>
<artifactId>grails-datastore-test-support</artifactId>
<version>1.0-grails-2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>scaffolding</artifactId>
<version>2.1.2</version>
<scope>compile</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>cache</artifactId>
<version>1.1.7</version>
<scope>compile</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>asset-pipeline</artifactId>
<version>1.8.11</version>
<scope>compile</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>hibernate4</artifactId>
<version>4.3.5.4</version>
<scope>runtime</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>database-migration</artifactId>
<version>1.4.0</version>
<scope>runtime</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>jquery</artifactId>
<version>1.11.1</version>
<scope>runtime</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>tomcat</artifactId>
<version>7.0.54</version>
<scope>provided</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>webxml</artifactId>
<version>1.4.1</version>
<type>zip</type>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<pluginManagement/>
<plugins>
<!-- Disables the Maven surefire plugin for Grails applications, as we have our own test runner -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>surefire-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>plugins</directory>
<includes>
<include>**/*</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.grails</groupId>
<artifactId>grails-maven-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<grailsVersion>${grails.version}</grailsVersion>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.grails.plugins</groupId>
<artifactId>kickstart-with-bootstrap</artifactId>
<version>1.1.0</version>
<configuration>
<grailsVersion>${grails.version}</grailsVersion>
</configuration>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>grails</id>
<name>grails</name>
<url>http://repo.grails.org/grails/core</url>
</repository>
<repository>
<id>grails-plugins</id>
<name>grails-plugins</name>
<url>http://repo.grails.org/grails/plugins</url>
</repository>
</repositories>
<profiles>
<profile>
<id>tools</id>
<activation>
<property>
<name>java.vendor</name>
<value>Sun Microsystems Inc.</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>${java.version}</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
You have 2 implementations incorrect here:
kickstart-with-bootstrap is a grails plugin dependency therefore it should be under <dependencies> section in pom.xml, instead of a maven plugin.
Grails plugins are packaged as zip and not jar, so the <type> of dependency should be zip
Solution:
Remove this section
<plugin>
<groupId>org.grails.plugins</groupId>
<artifactId>kickstart-with-bootstrap</artifactId>
<version>1.1.0</version>
<configuration>
<grailsVersion>${grails.version}</grailsVersion>
</configuration>
<extensions>true</extensions>
</plugin>
and add this section under <dependencies>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>kickstart-with-bootstrap</artifactId>
<version>1.1.0</version>
<type>zip</zip>
</dependency>

Resources