Jenkins - Selenium Maven test error - Failed to execute goal - java

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.

Related

How to setup akka persistence project

I'm attempting to run the sample project from How to setup akka persistence project : https://developer.lightbend.com/start/?group=akka&project=akka-samples-persistence-dc-java
When I try to run the example using the command :
mvn exec:java -Dexec.mainClass="sample.persistence.multidc.ThumbsUpApp" -Dexec.args="cassandra"
I receive the error:
[INFO] --< com.lightbend.akka.samples:akka-sample-replicated-event-sourcing-java >--
[INFO] Building Akka replicated event sourcing multi dc sample 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:3.0.0:java (default-cli) # akka-sample-replicated-event-sourcing-java ---
[WARNING]
java.lang.ClassNotFoundException: sample.persistence.multidc.ThumbsUpApp
at java.net.URLClassLoader.findClass (URLClassLoader.java:471)
at java.lang.ClassLoader.loadClass (ClassLoader.java:589)
at java.lang.ClassLoader.loadClass (ClassLoader.java:522)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:246)
at java.lang.Thread.run (Thread.java:834)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.426 s
[INFO] Finished at: 2021-07-25T20:52:54+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java (default-cli) on project akka-sample-replicated-event-sourcing-java: An exception occured while executing the Java class. sample.persistence.multidc.ThumbsUpApp -> [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
Looking at the project source:
The package sample.persistence.multidc.ThumbsUpApp does not appear to exist. How to include the missing package sample.persistence.multidc.ThumbsUpApp ? Shouldn't this project execute without adding additional src code ?
It seems you are referencing a class name that doesn't exist in the project source.
You may use the following command instead.
mvn exec:java -Dexec.mainClass="sample.persistence.res.MainApp" -Dexec.args="cassandra"

ERROR Failed to execute goal io.quarkus:quarkus-maven-plugin:1.13.2.Final:dev (default-cli) on project code-with-quarkus:

when I use the command mvn clean quarkus: dev, I get the following response from the terminal in intellij:
E:\api-hard-lot>mvn clean quarkus:dev
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< org.acme:code-with-quarkus >---------------------
[INFO] Building code-with-quarkus 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # code-with-quarkus ---
[INFO] Deleting E:\api-hard-lot\target
[INFO]
[INFO] --- quarkus-maven-plugin:1.13.2.Final:dev (default-cli) # code-with-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 31 source files to E:\api-hard-lot\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.052 s
[INFO] Finished at: 2021-04-25T12:02:55-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.13.2.Final:dev (default-cli) on project code-with-quarkus: Fatal error
compiling: invalid target release: 11 -> [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
'cmd' is not recognized as an internal command
or external, an operable program or a batch file.
Your project was created using JDK 11 and thus mandates JDK 11 while you are trying to build it with a JDK inferior to 11.
Either update your JDK (recommended) or adjust your project to be JDK 8 compatible (replace occurrences of 11 with 1.8 in your pom file).
thanks guys thats exactly my solution i alter to jdk 8 and
in pom
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
and
in code-with-quarkus

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

MAVEN SUREFIRE PLUGIN ERROR

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

Jenkins cannot execute Maven pom.xml

I have a big issue with my Jenkins on Mac OS. So I installed Jenkins, made a simple class and converted to Maven, created a new job on Jenkins and specify the pom.xml location ( which Jenkins sees it ok ) but when I try to build my class I always get an error as Jenkins cannot write mojo status or something.This is my console output
Started by user anonymous
Building in workspace /Users/Shared/Jenkins/Home/workspace/Cocotest
Parsing POMs
[Simple2] $ /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java -cp /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven31-agent-1.5.jar:/usr/local/apache-maven-3.3.9/boot/plexus-classworlds-2.5.2.jar:/usr/local/apache-maven-3.3.9/conf/logging jenkins.maven3.agent.Maven31Main /usr/local/apache-maven-3.3.9 /Users/Shared/Jenkins/Home/war/WEB-INF/lib/remoting-2.53.2.jar /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven31-interceptor-1.5.jar /Users/Shared/Jenkins/Home/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.5.jar 51372
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /Users/alex-macbook/Eclipse workspace/Simple2/pom.xml install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Simple2 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Simple2 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/alex-macbook/Eclipse workspace/Simple2/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # Simple2 ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.396 s
[INFO] Finished at: 2015-12-29T20:46:31+01:00
[INFO] Final Memory: 12M/144M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Simple2: Error while storing the mojo status: /Users/alex-macbook/Eclipse workspace/Simple2/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst (Permission denied) -> [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
[JENKINS] Archiving /Users/alex-macbook/Eclipse workspace/Simple2/pom.xml to simple/Simple2/0.0.1-SNAPSHOT/Simple2-0.0.1-SNAPSHOT.pom
/Users/alex-macbook/Eclipse workspace/Simple2/pom.xml is not inside /Users/Shared/Jenkins/Home/workspace/Cocotest/Users/alex-macbook/Eclipse workspace/Simple2/; will archive in a separate pass
channel stopped
Finished: FAILURE
Regarding this error message:
Error while storing the mojo status:
/Users/alex-macbook/Eclipse workspace/Simple2/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst (Permission denied)
I think it's more a permission problem.
Jenkins is running with a dedicated jenkins user.
Did you check this user has a R/W access in your working directory?

Categories

Resources