MAVEN SUREFIRE PLUGIN ERROR - java

Im building a custom maven project for jenkins. After using the command
mvn -Plight-test install
I recieve this error .Please help. I have also added the plugin for surefire exception in the pom.xml file, but it isn't working! The error log is as follows :
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Jenkins main module ................................ SUCCESS [ 11.809 s]
[INFO] Jenkins cli ........................................ SUCCESS [ 38.319 s]
[INFO] Jenkins core ....................................... FAILURE [11:15 min]
[INFO] Jenkins war ........................................ SKIPPED
[INFO] Tests for Jenkins core ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12:10 min
[INFO] Finished at: 2016-05-05T12:26:54+05:30
[INFO] Final Memory: 39M/277M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project jenkins-core:
.
[ERROR]
[ERROR] Please refer to C:\Users\Anishas\git\jenkins\core\target\surefire-reports for the individual test results.
[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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :jenkins-core
Compile :

I had the same issues and I found out that the problem was that some of tests tried to create a System link and it was not possible because I didn't start my IDE (IntellijIdea) as administrator in Windows.
I started Intellij as administrator and that solved the problem.
Skipping test is not a good practice when developing.

mvn -Dmaven.test.skip=true -DskipTests=true clean install
use this command

Rerun with mvn -Plight-test install -rf jenkins-core -X to isolate the error

Related

Maven dependency tree without install

I would like to run the mvn dependency:tree command on a lot of projects, but I sometimes get this error (example on google guava):
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Guava Maven Parent 31.1-jre:
[INFO]
[INFO] Guava Maven Parent ................................. SUCCESS [ 9.360 s]
[INFO] Guava: Google Core Libraries for Java .............. SUCCESS [ 1.473 s]
[INFO] Guava BOM .......................................... SUCCESS [ 4.277 s]
[INFO] Guava Testing Library .............................. SUCCESS [ 1.845 s]
[INFO] Guava Unit Tests ................................... SUCCESS [ 4.133 s]
[INFO] Guava GWT compatible libs .......................... FAILURE [ 8.632 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.051 s
[INFO] Finished at: 2022-03-15T15:22:05+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:tree (default-cli) on project guava-gwt: Execution default-cli of goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:tree failed: Plugin org.apache.maven.plugins:maven-dependency-plugin:3.1.1 or one of its dependencies could not be resolved: Could not find artifact com.google.guava:guava-tests:jar:test-sources:31.1-jre in sonatype-snapshots (https://oss.sonatype.org/content/repositories/snapshots/) -> [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/PluginResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :guava-gwt
If I run mvn install before this error does not appear. My problem is that sometimes the mvn install does not work.
Is there a way to make mvn dependency:tree work without using mvn install before?

Jenkins - Selenium Maven test error - Failed to execute goal

I am using Jenkins (2.107.2) to run a maven test for the first time.
Platform : Linux
It is a java program using selenium, it fails on the following issue below.
I have tried manually deleted the directory prior to running but made no difference.
And set the permissions of the folder to be accessed by anyone. ?
any ideas / pointers why it is going wrong ?
13:34:30 Started by user Test User
13:34:30 Building in workspace /home/test.user/eclipse-workspace/Carspares Automation
13:34:30 Xvfb starting$ Xvfb :1 -fbdir /var/lib/jenkins/xvfb-28-..fbdir7240341890394839754
13:34:35 [Carspares Automation] $ /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven/bin/mvn -f "/home/test.user/eclipse-workspace/Carspares Automation/pom.xml" clean test
13:34:36 [INFO] Scanning for projects...
13:34:36 [INFO]
13:34:36 [INFO] -------------------------< Automation:Jenkins >-------------------------
13:34:36 [INFO] Building Jenkins 0.0.1-SNAPSHOT
13:34:36 [INFO] --------------------------------[ jar ]---------------------------------
13:34:37 [INFO]
13:34:37 [INFO] --- maven-clean-plugin:2.5:clean (default-clean) # Jenkins ---
13:34:37 [INFO] Deleting /home/test.user/eclipse-workspace/Carspares Automation/target
13:34:38 [INFO] ------------------------------------------------------------------------
13:34:38 [INFO] BUILD FAILURE
13:34:38 [INFO] ------------------------------------------------------------------------
13:34:38 [INFO] Total time: 1.647 s
13:34:38 [INFO] Finished at: 2018-04-30T13:34:38+01:00
13:34:38 [INFO] ------------------------------------------------------------------------
13:34:38 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project Jenkins: Failed to clean project: Failed to delete /home/test.user/eclipse-workspace/Carspares Automation/target/classes/Jenkins_TestNG/GetScreenshot.class -> [Help 1]
13:34:38 [ERROR]
13:34:38 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
13:34:38 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
13:34:38 [ERROR]
13:34:38 [ERROR] For more information about the errors and possible solutions, please read the following articles:
13:34:38 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
13:34:38 Build step 'Invoke top-level Maven targets' marked build as failure
13:34:38 [htmlpublisher] Archiving HTML reports...
13:34:38 [htmlpublisher] Archiving at PROJECT level /home/test.user/eclipse-workspace/Carspares Automation/test-output to /var/lib/jenkins/jobs/Reserve Vehicle Maven/htmlreports/HTML_20Report
13:34:38 TestNG Reports Processing: START
13:34:38 Looking for TestNG results report in workspace using pattern: **/testng-results.xml
13:34:38 testng-results.xml was last modified before this build started. Ignoring it.
13:34:38 Saving reports...
13:34:38 Found matching files but did not find any TestNG results.
13:34:38 Xvfb stopping
13:34:38 Finished: FAILURE
Have run the MVN clean from the eclipse ide See result:
Cant do from command line at them moment due to my permissions on a shared vm.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Jenkins 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # Jenkins ---
[INFO] Deleting /home/test.user/eclipse-workspace/Carspares Automation/target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.177 s
[INFO] Finished at: 2018-04-30T14:35:50+01:00
[INFO] Final Memory: 9M/304M
[INFO] ------------------------------------------------------------------------
Re ran in jenkins and then have a slightly different error.
14:36:14 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project Jenkins: Failed to clean project: Failed to delete /home/test.user/eclipse-workspace/Carspares Automation/target/classes/META-INF/MANIFEST.MF -> [Help 1]
14:36:14 [ERROR]
14:36:14 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
14:36:14 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
14:36:14 [ERROR]
i can now run the clean from the command line. It successfully cleaned.
ran jenkins again , with the following error...
15:40:51 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Jenkins: Fatal error compiling: directory not found: /home/test.user/eclipse-workspace/Carspares Automation/target/classes -> [Help 1]
Add clean to your CLI command.
If you execute mvn test then it should be mvn clean test.
And the issue could be caused by the space you can find in your project name, I suggest to trim spaces in the project name.
For anyone elses reference.
I never found the cause of the issue nor could fix it.
I deleted the maven project in eclipse, created a new one. The new one then worked ok .....
Thanks for any feedback.

The system cannot find the file specified while trying to install JAR with sources with Maven

I was using the followig command to build the project
mvn compile exec:java clean install
and it was working. I wished it to install sources to local repository and wrote
mvn compile exec:java source:jar clean install
and now it fails with
...
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing MYSOURCEPATH\target\my-library-1.12.1.jar with MYSOURCEPATH\target\my-library-1.12.1-shaded.jar
[INFO] Dependency-reduced POM written at: MYSOURCEPATH\dependency-reduced-pom.xml
[INFO] Dependency-reduced POM written at: MYSOURCEPATH\dependency-reduced-pom.xml
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # my-library ---
[INFO] Installing MYSOURCEPATH\target\my-library-1.12.1.jar to MYLOCALREPOPATH\MYLIBRARYPATH\1.12.1\my-library-1.12.1.jar
[INFO] Installing MYSOURCEPATH\dependency-reduced-pom.xml to MYLOCALREPOPATH\MYLIBRARYPATH\1.12.1\my-library-1.12.1.pom
[INFO] Installing MYSOURCEPATH\target\my-library-1.12.1-sources.jar to MYLOCALREPOPATH\MYLIBRARYPATH\1.12.1\my-library-1.12.1-sources.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.280 s
[INFO] Finished at: 2018-02-26T18:38:23+03:00
[INFO] Final Memory: 46M/1373M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project my-library: Failed to install artifact my.library.fqn:my-library:jar:sources:1.12.1: MYSOURCEPATH\target\my-library-1.12.1-sources.jar (The system cannot find the file specified) -> [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/MojoExecutionException
how to fix/overcome?
Try
mvn clean source:jar compile install exec:java
Or just:
mvn clean source:jar install exec:java
So basically you need to put the "clean" before the "source:jar"
or else installation for sources will fail

installing 3rd party JARs

I have a maven project in Eclipse called TdkUtils, with this pom.xml:
This is a utils project. So I want to create a jar, put it in the repository and use it in another projects.
...
<groupId>com.tdk</groupId>
<artifactId>tdkUtils</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>tdkUtils</name>
...
But I got these errors when installing the plugin:
MacBook-Pro-de-nunito:tdkUtils nunito$ mvn install:install-file -Dfile=target/tdkUtils-0.0.1-SNAPSHOT.jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building tdkUtils 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) # tdkUtils ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.353 s
[INFO] Finished at: 2017-09-18T11:29:58+02:00
[INFO] Final Memory: 9M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install-file (default-cli) on project tdkUtils: The artifact information is incomplete or not valid:
[ERROR] [0] 'groupId' is missing.
[ERROR] [1] 'artifactId' is missing.
[ERROR] [2] 'packaging' is missing.
[ERROR] [3] 'version' is missing.
[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/MojoExecutionException
If you just execute mvn install while inside the same directory with the util pom.xml file, maven will install the jar file into local repository for the user.
After that, the jar file can be used by the same user from other projects.
you can install a jar to local repo without pom.xml like this:
mvn install:install-file -Dfile=target/tdkUtils-0.0.1-SNAPSHOT.jar -DgroupId=com.tdk -DartifactId=tdkUtils -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar

How to run mvn verify in a maven-download disabled box?

I need to run mvn verify in a secured box where maven is not able to download anything. I am able to run the command on my local laptop, so I copied my local .m2 folder to the secured box. However, I got this error:
$ mvn verify -o
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building <Masked strings>
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.109s
[INFO] Finished at: Wed May 07 20:49:26 UTC 2014
[INFO] Final Memory: 10M/232M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5: The repository system is offline but the artifact org.apache.maven.plugins:maven-plugins:pom:19 is not available in the local repository. -> [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/PluginResolutionException
So, looks like copying .m2 is not enough. So, what should I do to make sure maven can do the job without downloading anything?
Thank you very much.

Categories

Resources