What is the use of sure-fire plugin in my pom - java

In my pom.xml there are two plugins added of surefire and I'm confused why are they used.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<!--<skipTests>false</skipTests>-->
<testFailureIgnore>true</testFailureIgnore>
<!-- <forkMode>once</forkMode> -->
<!-- Sets the VM argument line used when unit tests are run. -->
<argLine>${surefireArgLine}</argLine>
<includes>
<include>**/*TestApp.java</include>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<!-- <skipTests>false</skipTests>-->
<testFailureIgnore>true</testFailureIgnore>
<!-- <forkMode>once</forkMode> -->
<includes>
<include>**/*TestApp.java</include>
<include>**/*Test.java</include>
</includes>
<argLine>-Xms128m</argLine>
<argLine>-Xmx512m</argLine>
<argLine>-XX:MaxPermSize=256m</argLine>
</configuration>
</plugin>
also, if I just comment true then my maven build starts to fail. can someone please explain this and also how to resolve this as well.
EDIT 1
Here is my error stack when I run maven test
**SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/eclipse-jee-2022-09-R-win32-x86_64/eclipse/plugins/org.eclipse.m2e.maven.runtime_3.8.601.20220820-1147/jars/maven-slf4j-provider-3.8.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/D:/eclipse-jee-2022-09-R-win32-x86_64/eclipse/configuration/org.eclipse.osgi/917/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.MavenSimpleLoggerFactory]
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/eclipse-jee-2022-09-R-win32-x86_64/eclipse/plugins/org.eclipse.m2e.maven.runtime_3.8.601.20220820-1147/jars/maven-slf4j-provider-3.8.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [file:/D:/eclipse-jee-2022-09-R-win32-x86_64/eclipse/configuration/org.eclipse.osgi/917/0/.cp/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.MavenSimpleLoggerFactory]
[[INFO[m] Scanning for projects...
[[mWARNING[m]
[[mWARNING[m] Some problems were encountered while building the effective model for com.apc:designportal:war:22.1.2
[[mWARNING[m] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: junit:junit:jar -> duplicate declaration of version 4.12 # line 430, column 15
[[mWARNING[m] Reporting configuration should be done in <reporting> section, not in maven-site-plugin <configuration> as reportPlugins parameter. # line 973, column 20
[[mWARNING[m]
[[mWARNING[m] It is highly recommended to fix these problems because they threaten the stability of your build.
[[mWARNING[m]
[[mWARNING[m] For this reason, future Maven versions might no longer support building such malformed projects.
[[mWARNING[m]
[[INFO[m]
[[INFO[m] [1m------------------------< [0;36mcom.apc:designportal[0;1m >------------------------[m
[[INFO[m] [1mBuilding SE Design Portal 22.1.2[m
[[INFO[m] [1m--------------------------------[ war ]---------------------------------[m
[[mWARNING[m] The POM for com.apc.designtools:dp-quotingsystem-integration:jar:0.4 is missing, no dependency information available
[[mWARNING[m] The artifact org.hibernate:hibernate-validator:jar:6.2.5.Final has been relocated to org.hibernate.validator:hibernate-validator:jar:6.2.5.Final
[[mWARNING[m] The artifact javax.xml:jaxrpc:jar:1.1 has been relocated to javax.xml:jaxrpc-api:jar:1.1
[[INFO[m]
[[INFO[m] [1m--- [0;32mmaven-resources-plugin:2.6:resources[m [1m(default-resources)[m # [36mdesignportal[0;1m ---[m
[[mWARNING[m] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[[INFO[m] Copying 14 resources
[[INFO[m] Copying 83 resources
[[INFO[m]
[[INFO[m] [1m--- [0;32mmaven-compiler-plugin:3.10.1:compile[m [1m(default-compile)[m # [36mdesignportal[0;1m ---[m
[[INFO[m] Nothing to compile - all classes are up to date
[[INFO[m]
[[INFO[m] [1m--- [0;32mmaven-resources-plugin:2.6:testResources[m [1m(default-testResources)[m # [36mdesignportal[0;1m ---[m
[[mWARNING[m] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[[INFO[m] Copying 8 resources
[[INFO[m]
[[INFO[m] [1m--- [0;32mmaven-compiler-plugin:3.10.1:testCompile[m [1m(default-testCompile)[m # [36mdesignportal[0;1m ---[m
[[INFO[m] Nothing to compile - all classes are up to date
[[INFO[m]
[[INFO[m] [1m--- [0;32mmaven-surefire-plugin:2.22.0:test[m [1m(default-test)[m # [36mdesignportal[0;1m ---[m
[[INFO[m]
[[INFO[m] -------------------------------------------------------
[[INFO[m] T E S T S
[[INFO[m] -------------------------------------------------------
[[INFO[m]
[[INFO[m] Results:
[[INFO[m]
[[INFO[m] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[[INFO[m]
[[INFO[m] [1m------------------------------------------------------------------------[m
[[INFO[m] [1;31mBUILD FAILURE[m
[[INFO[m] [1m------------------------------------------------------------------------[m
[[INFO[m] Total time: 3.939 s
[[INFO[m] Finished at: 2023-02-02T11:50:54+05:30
[[INFO[m] [1m------------------------------------------------------------------------[m
[[1;31mERROR[m] Failed to execute goal [32morg.apache.maven.plugins:maven-surefire-plugin:2.22.0:test[m [1m(default-test)[m on project [36mdesignportal[m: [1;31mThere are test failures.[m
[[1;31mERROR[m] [1;31m[m
[[1;31mERROR[m] [1;31mPlease refer to C:\Users\SESA701739\Downloads\Repository for openJDK17\designportal\target\surefire-reports for the individual test results.[m
[[1;31mERROR[m] [1;31mPlease refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.[m
[[1;31mERROR[m] [1;31mThe forked VM terminated without properly saying goodbye. VM crash or System.exit called?[m
[[1;31mERROR[m] [1;31mCommand was cmd.exe /X /C "D:\eclipse-jee-2022-09-R-win32-x86_64\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\java -XX:MaxPermSize=256m -jar C:\Users\SESA70~1\AppData\Local\Temp\surefire14215564203121122107\surefirebooter2253485858284748685.jar C:\Users\SESA701739\AppData\Local\Temp\surefire14215564203121122107 2023-02-02T11-50-54_343-jvmRun1 surefire12140783555302454556tmp surefire_04303044982407970188tmp"[m
[[1;31mERROR[m] [1;31mError occurred in starting fork, check output in log[m
[[1;31mERROR[m] [1;31mProcess Exit Code: 1[m
[[1;31mERROR[m] [1;31morg.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?[m
[[1;31mERROR[m] [1;31mCommand was cmd.exe /X /C "D:\eclipse-jee-2022-09-R-win32-x86_64\eclipse\plugins\org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038\jre\bin\java -XX:MaxPermSize=256m -jar C:\Users\SESA70~1\AppData\Local\Temp\surefire14215564203121122107\surefirebooter2253485858284748685.jar C:\Users\SESA701739\AppData\Local\Temp\surefire14215564203121122107 2023-02-02T11-50-54_343-jvmRun1 surefire12140783555302454556tmp surefire_04303044982407970188tmp"[m
[[1;31mERROR[m] [1;31mError occurred in starting fork, check output in log[m
[[1;31mERROR[m] [1;31mProcess Exit Code: 1[m
[[1;31mERROR[m] [1;31m at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:671)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:533)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:278)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:244)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1194)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1022)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:868)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:370)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:351)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:171)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:163)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.cli.MavenCli.execute(MavenCli.java:960)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)[m
[[1;31mERROR[m] [1;31m at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)[m
[[1;31mERROR[m] [1;31m at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[m
[[1;31mERROR[m] [1;31m at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)[m
[[1;31mERROR[m] [1;31m at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[m
[[1;31mERROR[m] [1;31m at java.base/java.lang.reflect.Method.invoke(Method.java:568)[m
[[1;31mERROR[m] [1;31m at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)[m
[[1;31mERROR[m] [1;31m at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)[m
[[1;31mERROR[m] [1;31m at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)[m
[[1;31mERROR[m] [1;31m at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)[m
[[1;31mERROR[m] [1;31m[m
[[1;31mERROR[m] -> [1m[Help 1][m
[[1;31mERROR[m]
[[1;31mERROR[m] To see the full stack trace of the errors, re-run Maven with the [1m-e[m switch.
[[1;31mERROR[m] Re-run Maven using the [1m-X[m switch to enable full debug logging.
[[1;31mERROR[m]
[[1
> Blockquote
;31mERROR[m] For more information about the errors and possible solutions, please read the following articles:
[[1;31mERROR[m] [1m[Help 1][m http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException**
And for this I'm unable to get the idea. If I just comment the testfailureIgnore true so that would not be a solution.

Related

mvn release:prepare not committing changes

I am trying to release my project using maven release:prepare command. My code resides in gitlab and I have provided my project url in the pom.xml but while trying to update in Git it fails. Could someone help me with in understanding what I could be doing wrong.
Build plugin is:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<tagNameFormat>r#{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
SCM tags are mentioned as below:
<scm>
<developerConnection>scm:git:https://gitlab-mac-p7.systems.private/test/testservice.git</developerConnection>
<tag>testservice-0.100.0-delete</tag>
</scm>
Below is the error stack trace:
maven release:prepare The git-commit command failed Repository has been updated, but unable to write
[INFO] Executing: cmd.exe /X /C "git commit --verbose -F C:\Users\P7846763\AppData\Local\Temp\2\maven-scm-392995137.commit pom.xml"
[INFO] Working directory: C:\DEP\Code\eecc\testservice-feature-FMW-5241-releaseTest
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:03 min
[INFO] Finished at: 2021-08-19T15:08:55+05:30
[INFO] Final Memory: 13M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project testservice: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-commit command failed.
[ERROR] Command output:
[ERROR] fatal: Repository has been updated, but unable to write
[ERROR] new_index file. Check that disk is not full and quota is
[ERROR] not exceeded, and then "git reset HEAD" to recover.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project testservice: Unable to commit files
Provider message:
The git-commit command failed.
Command output:
fatal: Repository has been updated, but unable to write
new_index file. Check that disk is not full and quota is
not exceeded, and then "git reset HEAD" to recover.

maven - mvn test fail: Killing self fork JVM. Maven process died

When I run in my command line mvn clean test I get the following failure
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.703 s
[INFO] Finished at: 2018-09-04T07:14:01+01:00
[INFO] Final Memory: 46M/549M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20.1:test (default-test) on project <projectname>: There are test failures.
[ERROR]
[ERROR] Please refer to c:\username\Dev\workspaceIntellij\projectname\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C "c:\username\Dev\jdk1.8\jre\bin\java -jar C:\Users\username\AppData\Local\Temp\surefire7773794300145922453\surefirebooter7859772817341969410.jar C:\Users\username\AppData\Local\Temp\surefire777379430014592245
3 2018-09-04T07-13-59_140-jvmRun1 surefire8109947353298297465tmp surefire_06749094174024198560tmp"
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
[ERROR] Command was cmd.exe /X /C "c:\username\Dev\jdk1.8\jre\bin\java -jar C:\Users\username\AppData\Local\Temp\surefire7773794300145922453\surefirebooter7859772817341969410.jar C:\Users\username\AppData\Local\Temp\surefire777379430014592245
3 2018-09-04T07-13-59_140-jvmRun1 surefire8109947353298297465tmp surefire_06749094174024198560tmp"
[ERROR] Error occurred in starting fork, check output in log
[ERROR] Process Exit Code: 1
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:686)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:535)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:280)
[ERROR] at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:245)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1124)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:954)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:832)
[ERROR] at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
[ERROR] at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR] at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
[ERROR] at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
[ERROR] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
[ERROR] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
[ERROR] at org.apache.maven.cli.MavenCli.execute(MavenCli.java:955)
[ERROR] at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290)
[ERROR] at org.apache.maven.cli.MavenCli.main(MavenCli.java:194)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
[ERROR] at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR]
[ERROR] -> [Help 1]
In the surefire-report it says
# Created on 2018-09-04T07:34:08.345
Killing self fork JVM. Maven process died.
These are my maven and java versions:
Maven home: c:\username\Dev\apache-maven-3.5.2
Java version: 1.8, vendor: Oracle Corporation
Java home: c:\username\Dev\jdk1.8\jre
When I run mvn clean test from intellij it works. It uses /c/Program Files (x86)/Jetbrains/IntelliJ IDEA Ultimate 17.2.2/plugins/maven/lib/maven3/bin/mvn and it also works when I paste that in the command line.
Thanks for the help
In my case (openjdk11, maven 3.6, docker on windows 10) the solution was to update maven-surefire-plugin from 2.21.0 to 2.22.2.
Looks that its duplicate of surefire-error
The solution was:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>XXXXXXXXX.XXXXXX-some-version</version>
<!-- ADD THIS: --->
<configuration>
<skipTests>false</skipTests>
<testFailureIgnore>true</testFailureIgnore>
<forkMode>once</forkMode>
</configuration>
</plugin>

Maven Compiler Plugin Build Failure with Werror argument and present warnings marked to be skipped

I am trying to use Maven compiler plugin to show all warnings and to fail the build if any warnings are there by configuring "Werror" parameter. My Pom.xml file settings for maven compiler plug in is -
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<source>1.7</source>
<target>1.7</target>
<compilerArgs>
<arg>-Xlint:all</arg>
<arg>-Xlint:-deprecation</arg>
<arg>-Xlint:-unchecked</arg>
<arg>-Xlint:-rawtypes</arg>
<arg>-g</arg>
<arg>Werror</arg>
</compilerArgs>
<verbose>true</verbose>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
In my project , I have these 3 warnings - deprecation, unchecked, rawtypes.
If I remove these arguments, then the build fails which is perfectly fine. -
<arg>-Xlint:-deprecation</arg>
<arg>-Xlint:-unchecked</arg>
<arg>-Xlint:-rawtypes</arg>
But when I add these arguments, compiler should ignore these kind of warnings and build should succeed.
But still Build is failing and doesn't show any specific error.
Build succeeds if I remove this argument.
<arg>Werror</arg>
So I am not able to run a successful build If we skip some of the warnings which are present in the project. Is there any way to achieve the same ?
PFB the error output of the mvn build command -
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.abcd:project:war:1.0
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.abcd.xyz:common:jar -> duplicate declaration of version 1.3 # line 87, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building PROJECT 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # vsmvam ---
[INFO] Deleting /home/ess/p4-sources/abcd/xyz/project/target
[INFO]
[INFO] --- jacoco-maven-plugin:0.6.1.201212231917:prepare-agent (default) # vsmvam ---
[INFO] argLine set to -javaagent:/home/ess/.m2/repository/org/jacoco/org.jacoco.agent/0.6.1.201212231917/org.jacoco.agent-0.6.1.201212231917-runtime.jar=destfile=/home/ess/p4-sources/mgmtplatform/vshield-main/vsmvam/target/jacoco.exec,excludes=com/vmware/vshield/vsm/**
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) # vsmvam ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 13 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # vsmvam ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 330 source files to /home/ess/p4-sources/abcd/xyz/project/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.590s
[INFO] Finished at: Fri Oct 06 01:51:08 PDT 2017
[INFO] Final Memory: 39M/892M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project vsmvam: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project vsmvam: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
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:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
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.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:976)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 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/MojoFailureException
After doing lot of changes I was able to finally figure out how to build successfully with "Werror" flag if all the Lint warnings are fixed.
I removed - "true"
Could not figure out exactly whats the reason why the build fails when we use Javac compiler.
Along with added UTF-8 encoding and suppressed Processing Lint warnings.
Working copy of configuration is -
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
<compilerArgs>
<arg>-Xlint:all</arg>
<arg>-Xlint:-processing</arg>
</compilerArgs>
</configuration>
</plugin>

After upgrading, getting "Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test" and "test(s) <[]> cannot be found"

I upgraded Selenium to support GeckoDriver, and then Jenkins with it. I'm pretty new to this behind-the-scenes-upgrading stuff. Since we're running Selenium 3, we no longer use the Selenium Grid plugin. I haven't been able to get any tests to run since then.
We run Windows 7 machines for the Jenkins master and slaves. If it makes any difference, we use Java. We also have a framework sitting atop Selenium.
In particular is this error that really bugs me:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project example-project: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: There was an error in the forked process
[ERROR] org.testng.TestNGException:
[ERROR]
[ERROR] The test(s) <[]> cannot be found.
[ERROR] at org.testng.TestNG.extractTestNames(TestNG.java:436)
I tried a little to alter the forking config but to no avail.
I've also played with the TestNG scope in the POM, but turning it to test causes TestNG classes to "not exist".
Full Results
Here are the full results I've been getting (run with Maven -e flag; I have the results with -X if needed):
Started by user anonymous
Building in workspace C:\Program Files (x86)\Jenkins\jobs\QA_Brochures_Test\workspace
Updating https://subversion.example.com/svn/example-test-center/trunk/FunctionalAutomation/ExampleProject at revision '2017-02-10T15:33:28.095 -0500'
A target\log4j2.xml
At revision 3234
No changes for https://subversion.example.com/svn/example-test-center/trunk/FunctionalAutomation/ExampleProject since the previous build
Parsing POMs
Modules changed, recalculating dependency graph
Established TCP socket on 60174
[workspace] $ "C:\Program Files\Java\jdk1.8.0_121/bin/java" -cp "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven33-agent-1.8.1.jar;C:\Maven3.3.9\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar;C:\Maven3.3.9\apache-maven-3.3.9/conf/logging" jenkins.maven3.agent.Maven33Main C:\Maven3.3.9\apache-maven-3.3.9 "C:\Program Files (x86)\Jenkins\war\WEB-INF\lib\remoting-3.4.1.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven33-interceptor-1.8.1.jar" "C:\Program Files (x86)\Jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.8.1.jar" 60174
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f C:\Program Files (x86)\Jenkins\jobs\QA_Brochures_Test\workspace\pom.xml clean test -e -DsuiteFile=src/main/test/suites/ca/alpha/desktop/QA_Brochures_Test.xml -Drunvehicle=All Models -Dwebdriver.gecko.driver=C:\browser-drivers\geckodriver-win64.exe
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.example.automation:example-project:jar:2.0.0-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for com.example.automation:automation-util:jar should not point at files within the project directory, ${basedir}/src/resources/lib/automation-util-1.18.1.jar will be unresolvable by dependent projects # line 105, column 16
[WARNING] 'dependencies.dependency.systemPath' for com.client.servicesapi:servicesapi:jar should not point at files within the project directory, ${basedir}/src/resources/lib/ServicesClientLibrary-1.2.112.jar will be unresolvable by dependent projects # line 112, column 16
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ExampleProject 2.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # example-project ---
[INFO] Deleting C:\Program Files (x86)\Jenkins\jobs\QA_Brochures_Test\workspace\target
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:add-source (add-source) # example-project ---
[INFO] Source directory: C:\Program Files (x86)\Jenkins\jobs\QA_Brochures_Test\workspace\src\main\objects added.
[INFO] Source directory: C:\Program Files (x86)\Jenkins\jobs\QA_Brochures_Test\workspace\src\main\test\classes added.
[INFO] Source directory: C:\Program Files (x86)\Jenkins\jobs\QA_Brochures_Test\workspace\src\main\test\suites added.
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:add-resource (add-resource) # example-project ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # example-project ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Program Files (x86)\Jenkins\jobs\QA_Brochures_Test\workspace\src\main\resources
[INFO] Copying 19 resources to resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) # example-project ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 212 source files to C:\Program Files (x86)\Jenkins\jobs\QA_Brochures_Test\workspace\target\classes
[INFO] /C:/Program Files (x86)/Jenkins/jobs/QA_Brochures_Test/workspace/src/main/objects/com/alpha/global/components/MyPlan.java: Some input files use or override a deprecated API.
[INFO] /C:/Program Files (x86)/Jenkins/jobs/QA_Brochures_Test/workspace/src/main/objects/com/alpha/global/components/MyPlan.java: Recompile with -Xlint:deprecation for details.
[INFO] /C:/Program Files (x86)/Jenkins/jobs/QA_Brochures_Test/workspace/src/main/test/classes/com/alpha/global/TC_GUX_BNP.java: C:\Program Files (x86)\Jenkins\jobs\QA_Brochures_Test\workspace\src\main\test\classes\com\alpha\global\TC_GUX_BNP.java uses unchecked or unsafe operations.
[INFO] /C:/Program Files (x86)/Jenkins/jobs/QA_Brochures_Test/workspace/src/main/test/classes/com/alpha/global/TC_GUX_BNP.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # example-project ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Program Files (x86)\Jenkins\jobs\QA_Brochures_Test\workspace\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) # example-project ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) # example-project ---
[INFO] No tests to run.
[INFO] Surefire report directory: C:\Program Files (x86)\Jenkins\jobs\QA_Brochures_Test\workspace\test-output
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[JENKINS] Recording test results
hudson.AbortException: Test reports were found but none of them are new. Did tests run?
For example, C:\Program Files (x86)\Jenkins\jobs\QA_Brochures_Test\workspace\test-output\TEST-TestSuite.xml is 1 mo 7 days old
at hudson.tasks.junit.TestResult.parse(TestResult.java:228)
at hudson.maven.reporters.SurefireArchiver.postExecute(SurefireArchiver.java:148)
at hudson.maven.Maven3Builder$MavenExecutionListener.recordMojoEnded(Maven3Builder.java:623)
at hudson.maven.Maven3Builder$MavenExecutionListener.mojoFailed(Maven3Builder.java:656)
at hudson.maven.Maven3Builder$JenkinsEventSpy.onEvent(Maven3Builder.java:300)
at org.apache.maven.eventspy.internal.EventSpyDispatcher.onEvent(EventSpyDispatcher.java:104)
at org.apache.maven.eventspy.internal.EventSpyExecutionListener.mojoFailed(EventSpyExecutionListener.java:138)
at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:90)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:219)
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:176)
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:133)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:68)
at hudson.remoting.UserRequest.perform(UserRequest.java:153)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:336)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.752 s
[INFO] Finished at: 2017-02-10T15:33:50-05:00
[INFO] Final Memory: 30M/265M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project example-project: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: There was an error in the forked process
[ERROR] org.testng.TestNGException:
[ERROR]
[ERROR] The test(s) <[]> cannot be found.
[ERROR] at org.testng.TestNG.extractTestNames(TestNG.java:436)
[ERROR] at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:310)
[ERROR] at org.testng.TestNG.run(TestNG.java:1088)
[ERROR] at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:281)
[ERROR] at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
[ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:121)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project example-project: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: There was an error in the forked process
org.testng.TestNGException:
The test(s) <[]> cannot be found.
at org.testng.TestNG.extractTestNames(TestNG.java:436)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:310)
at org.testng.TestNG.run(TestNG.java:1088)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:281)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:121)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
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:176)
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:133)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:68)
at hudson.remoting.UserRequest.perform(UserRequest.java:153)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:336)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: There was an error in the forked process
org.testng.TestNGException:
The test(s) <[]> cannot be found.
at org.testng.TestNG.extractTestNames(TestNG.java:436)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:310)
at org.testng.TestNG.run(TestNG.java:1088)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:281)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:121)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 31 more
Caused by: java.lang.RuntimeException: There was an error in the forked process
org.testng.TestNGException:
The test(s) <[]> cannot be found.
at org.testng.TestNG.extractTestNames(TestNG.java:436)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:310)
at org.testng.TestNG.run(TestNG.java:1088)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:281)
at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:121)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:584)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:460)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:229)
at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:201)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1026)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:862)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:755)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 32 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/PluginExecutionException
[JENKINS] Archiving C:\Program Files (x86)\Jenkins\jobs\QA_Brochures_Test\workspace\pom.xml to com.example.automation/example-project/2.0.0-SNAPSHOT/example-project-2.0.0-SNAPSHOT.pom
channel stopped
Finished: FAILURE
POM
<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>com.example.automation</groupId>
<artifactId>example-project</artifactId>
<version>2.0.0-SNAPSHOT</version>
<name>ExampleProject</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/objects</source>
<source>src/main/test/classes</source>
<source>src/main/test/suites</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-resource</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/resources</directory>
<targetPath>resources</targetPath>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<!-- <reuseForks>false</reuseForks> -->
<suiteXmlFiles>
<suiteXmlFile>${basedir}/${suiteFile}</suiteXmlFile>
</suiteXmlFiles>
<reportsDirectory>${basedir}/test-output</reportsDirectory>
<properties>
<property>
<name>testnames</name>
<value>${testname}</value>
</property>
<property>
<name>runvehicle</name>
<value>${runVehicle}</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.example.automation</groupId>
<artifactId>automation-util</artifactId>
<version>1.18.1</version>
<scope>system</scope>
<systemPath>${basedir}/src/resources/lib/automation-util-1.18.1.jar</systemPath>
</dependency>
<dependency>
<groupId>com.client.servicesapi</groupId>
<artifactId>servicesapi</artifactId>
<version>1.2.112</version>
<scope>system</scope>
<systemPath>${basedir}/src/resources/lib/ServicesClientLibrary-1.2.112.jar</systemPath>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.10</version>
<!-- <scope>test</scope> -->
</dependency>
<!-- When updating Selenium here, ensure automation-util's POM is updated also! -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.qualitycheck/quality-check -->
<dependency>
<groupId>net.sf.qualitycheck</groupId>
<artifactId>quality-check</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</project>
Suite XML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="FOC Brochures">
<listeners>
<listener class-name="com.example.util.result.CustomReportListener" />
</listeners>
<parameter name="browser" value="gecko" />
<parameter name="mailingList" value="AUTO, FOC" />
<parameter name="remote" value="true" />
<parameter name="model" value="${runVehicle}" />
<test name="QA-Alpha-English">
<parameter name="baseUrl" value="http://wwwmgqa.alpha.ca/brochures/" />
<classes>
<class name="ca.alpha.desktop.TC_FOC_Brochures">
<methods>
<!--
<include name="init" />
-->
</methods>
</class>
</classes>
</test>
<test name="QA-Alpha-French">
<parameter name="baseUrl" value="http://fr-wwwmgqa.alpha.ca/brochures/" />
<classes>
<class name="ca.alpha.desktop.TC_FOC_Brochures">
<methods>
<!--
<include name="init" />
-->
</methods>
</class>
</classes>
</test>
</suite>
Any ideas on how to remedy this? Thank you in advance.
UPDATE
After removing testnames from Surefire completely and running again, I'm now getting this error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project example-project: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: There was an error in the forked process
[ERROR] org.testng.TestNGException:
[ERROR]
[ERROR] Cannot instantiate class com.example.util.result.CustomReportListener
[ERROR] at org.testng.internal.ClassHelper.newInstance(ClassHelper.java:53)
[ERROR] at org.testng.TestNG.initializeConfiguration(TestNG.java:981)
[ERROR] at org.testng.TestNG.run(TestNG.java:1089)
[ERROR] at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:281)
[ERROR] at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:75)
[ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:121)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
[ERROR] Caused by: java.lang.ExceptionInInitializerError
[ERROR] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[ERROR] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[ERROR] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[ERROR] at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
Waiting for Jenkins to finish collecting data
[ERROR] at java.lang.Class.newInstance(Class.java:442)
[ERROR] at org.testng.internal.ClassHelper.newInstance(ClassHelper.java:51)
[ERROR] ... 8 more
[ERROR] Caused by: java.lang.NullPointerException
[ERROR] at sun.awt.shell.Win32ShellFolder2.access$200(Win32ShellFolder2.java:72)
[ERROR] at sun.awt.shell.Win32ShellFolder2$1.call(Win32ShellFolder2.java:242)
[ERROR] at sun.awt.shell.Win32ShellFolder2$1.call(Win32ShellFolder2.java:237)
[ERROR] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[ERROR] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[ERROR] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[ERROR] at sun.awt.shell.Win32ShellFolderManager2$ComInvoker$3.run(Win32ShellFolderManager2.java:547)
[ERROR] at java.lang.Thread.run(Thread.java:745)
[ERROR] -> [Help 1]
Where the CustomReportListener class is inside the automation-util JAR, which is stored in src/resources/lib typically, though I've also tested it in a class source folder (src/main/test/classes).
Your surefire plugin configuration indicates that you would be choosing both the suite file and also the set of tests ( <test> tags) at run time via JVM arguments.
<property>
<name>testnames</name>
<value>${testname}</value>
</property>
Please ensure that you pass a valid value to the set of <test> tags via the JVM argument -Dtestnames.
Replace maven compiler plugin in pom.xml with following plugin. Hope so it will work.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<version>3.6.1</version>
I had a similar issue. This occurs when you import the project and try to build it.
Make sure you have these steps setup properly:
Window->Preferences->Java->Installed JREs =pointing to jdk 1.8
Right click on the project and select Properties and then click on 'Project Facets' and make sure the right selections are made like Dynamic Web Module and version number, Java and its version. On the right pane ,select the Runtimes tab and make sure to check the correct Tomcat version that you are trying to run the project on.

Maven - JAVA_HOME location and Compilation failure executing javac

---skippable part---
Hi all, first time here and hopefully I'm not writing a clone of anything else. I spent days looking for cases like mine and all the things I tried failed to work, or couldn't simply find the correct solution for me.
I'm trying to use Maven on another student's project I'm working on (have to continue what he already did) for a school project, on a pc with Ubuntu 14.04. I'm in my project directory downloaded from github and I need to create a .war file and use that for Tomcat.
I was following a guide of that student, and probably I'm a little confused on what to do.
---tl:dr i need help---
So when I launch mvn -version, I get this:
Java version: 1.7.0_101, vendor: Oracle Corporation Java home:
/usr/lib/jvm/java-7-openjdk-amd64/jre Default locale: it_IT, platform
encoding: UTF-8 OS name: "linux", version: "3.19.0-58-generic", arch:
"amd64", family: "unix"
Few days ago I had problems with $JAVA_HOME environment variable and probably solved it managing the /etc/environment file, in fact I don't get any error about this. Now when I do a mvn package I get
[INFO] Scanning for projects... [INFO]
[INFO]
------------------------------------------------------------------------ [INFO] Building GWT Maven Archetype 2.6.0-SNAPSHOT [INFO]
------------------------------------------------------------------------ [INFO] [INFO] --- maven-enforcer-plugin:1.3.1:enforce
(enforce-versions) # webprotege --- [INFO] [INFO] ---
gwt-maven-plugin:2.7.0:generateAsync (default) # webprotege --- [INFO]
[INFO] --- build-helper-maven-plugin:1.8:add-source (add-source) #
webprotege --- [INFO] Source directory:
/home/wapaolo/Documenti/data/webprotege/webprotege/target/generated-sources/gwt
added. [INFO] [INFO] --- maven-resources-plugin:2.3:resources
(default-resources) # webprotege --- [INFO] Using 'UTF-8' encoding to
copy filtered resources. [INFO] Copying 10 resources [INFO] [INFO]
--- maven-compiler-plugin:2.3.2:compile (default-compile) # webprotege --- [INFO] Compiling 1744 source files to /home/wapaolo/Documenti/data/webprotege/webprotege/target/webprotege-2.6.0-SNAPSHOT/WEB-INF/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : [INFO]
------------------------------------------------------------- [ERROR] Failure executing javac, but could not parse the error: javac: invalid
target release: 1.8 Usage: javac use -help
for a list of possible options
[INFO] 1 error [INFO]
------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO]
------------------------------------------------------------------------ [INFO] Total time: 5.241s [INFO] Finished at: Mon May 09 16:54:04 CEST
2016 [INFO] Final Memory: 18M/295M [INFO]
------------------------------------------------------------------------ [ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile
(default-compile) on project webprotege: Compilation failure [ERROR]
Failure executing javac, but could not parse the error: [ERROR] javac:
invalid target release: 1.8 [ERROR] Usage: javac [ERROR] use -help for a list of possible options [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/MojoFailureException
So what should I do to proceed now? I've no clue..
Your maven project wants java 1.8 but your compiler is 1.7. Look in the pom.xml file for something like
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
and change that to 1.7 OR download the 1.8 jdk.

Categories