I am using the SonarQube Gradle plugin version 3.0 with Gradle 6.7.1 for analysis of my Java code. This works fine and the results are uploaded to Sonar. When I do gradlew clean test sonarqube initially I have no problem. But when I run it subsequently I get the following:
java.io.IOException: Unable to delete directory 'C:\xxx\build'
Failed to delete some children. This might happen because a process has
files open or has its working directory set in the target directory.
- C:\xxx\build\sonar\findbugs\findsecbugs-plugin.jar
- C:\xxx\build\sonar\findbugs
- C:\xxx\build\sonar
This keep on failing until I kill the Gradle daemon after which I can successfully run sonarqube again.
Is there a way to get around this?
When I try to run a single test in commandline like this:
gradle test --tests *MatchfichePageTest
I get the following error:
A problem was found with the configuration of task ':test'.
> Cannot write to file '/Users/macbookprobartvr/Documents/workspace/aem-site-sporza-tests/build/allure-results' specified for property '$1' as it is a directory.
Full stacktrace: I cannot post because stackoverflow is complaining that there is to much code ...
Does someone know what the problem is?
Gradle version 5.2.1
Delete the build/allure-results folder before running the test.
rm -rf /Users/macbookprobartvr/Documents/workspace/aem-site-sporza-tests/build/allure-results
now run the test, it should work now.
I'm trying to test build a maven based project in jenkins.
https://github.com/tonsV2/Lift-Log-Backend
However I get the following error.
[Lift Log Backend] $ /bin/sh -xe /tmp/hudson4180120395829748105.sh
+ ./mvnw clean
Error: Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Any clues?
Seems like you have spaces in your Jenkins job name. Try to rename your job from "Lift Log Backend" to "Lift-Log-Backend"
I had the same issue, after renaming the Jenkins job, the error was gone.
We were trying to implement Static Code Analyzers in our Hudson CI and was trying as mentioned here but, i came across about using SONAR for the same feature. We performed the following steps , but got error when the Hudson Job runs
Installed Sonar & running
Installed Sonar plugin in Hudson and configured hudson with sonar instance details
Configured Sonar details for the already defined job
The hudson job ran successfully until it deployed the WAR file to Tomcat6, but it failed when it started the sonar operations.
We received the following error in the Hudson job console
java.io.IOException: Cannot run program "mvn.bat" (in directory "D:\Users\abcd.hudson\jobs\QA Build Local\workspace\view"): CreateProcess error=2, The system cannot find the file specified
mvn.bat -f "D:\Users\abcd\.hudson\jobs\QA Build Local\workspace\view\msaccess\MyApp\Code\appone\pom.xml" -e -B sonar:sonar -Dsonar.host.url=http://localhost:9000/ -Dsonar.language=java
FATAL: command execution failed
java.io.IOException: Cannot run program "mvn.bat" (in directory "D:\Users\abcd\.hudson\jobs\QA Build Local\workspace\view"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
at hudson.Proc$LocalProc.(Proc.java:192)
at hudson.Proc$LocalProc.(Proc.java:164)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:639)
at hudson.Launcher$ProcStarter.start(Launcher.java:274)
at hudson.Launcher$ProcStarter.join(Launcher.java:281)
at hudson.tasks.Maven.perform(Maven.java:263)
at hudson.plugins.sonar.utils.SonarMaven.executeMaven(SonarMaven.java:138)
at hudson.plugins.sonar.SonarPublisher.executeSonar(SonarPublisher.java:300)
at hudson.plugins.sonar.SonarPublisher.perform(SonarPublisher.java:261)
at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:630)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:608)
at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:584)
at hudson.model.Build$RunnerImpl.post2(Build.java:159)
at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:553)
at hudson.model.Run.run(Run.java:1390)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:145)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
... 19 more
Sonar analysis completed: FAILURE
We manually ran the maven-sonar command from command prompt and the sonar analysis completed successfully and the results published in the sonar website.
Note: We observed that the M2_HOME environment variable is not set in the server. Would this be an error ?
Update on Fix:
We set maven_home\bin folder in windows PATH environment variable and then sonar was able to recognize mvn.bat and run.
Sonar is being run as a separate Maven program. The command line is being displayed at the top of the log:
mvn.bat -f "D:\Users\abcd.hudson\jobs\QA Build Local\workspace\view\msaccess\MyApp\Code\appone\pom.xml" -e -B sonar:sonar -Dsonar.host.url=http://localhost:9000/ -Dsonar.language=java
This is expected, you attached screen shots specified this Sonar configuration.
Your problem does not appear to be the job configuration, instead Jenkins is unable to find the "mvn.bat" command....
java.io.IOException: Cannot run program "mvn.bat" (in directory "D:\Users\abcd.hudson\jobs\QA Build Local\workspace\view"): CreateProcess error=2, The system cannot find the file specified
You need to investigate how you've configured Maven.
I had the same. In my case I had to change location of maven directory - when it was in "c:\Program Files (x86)\wamp\bin\apache-maven-3.2.1\" it couldn't run, but when I moved it to "c:\maven" (and changed system variable: "Path" including "C:\maven\bin" and created by me "MAVEN_HOME = c:\maven").
I had to reboot computer to work - check in windows console (logo windows -> run "cmd") by typing "mvn -version" and you should have line "Maven home: C:\maven"
Installation
Jenkins installed as war in Tomcat
Tomcat installed as a service in Windows
I've installed Maven and correctly configured environment variables in Windows
Problem
FATAL: command execution failed
java.io.IOException: Cannot run program "mvn.bat" (in directory "C:\.jenkins\workspace\my_project"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:470)
at hudson.Proc$LocalProc.<init>(Proc.java:244)
at hudson.Proc$LocalProc.<init>(Proc.java:216)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:803)
at hudson.Launcher$ProcStarter.start(Launcher.java:381)
at hudson.Launcher$ProcStarter.join(Launcher.java:388)
at hudson.tasks.Maven.perform(Maven.java:328)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
at hudson.model.Run.execute(Run.java:1759)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:177)
at java.lang.ProcessImpl.start(ProcessImpl.java:28)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
Solution
I've restarted Tomcat service so it has loaded the last configured Maven's environment variables making them available to Jenkins.
I currently get the error below trying to run roofline. It would be nice if any of you could help me out getting this up and running in my new environment?
bravegag#bravegag-MacBookPro:/opt/roofline/tool$ ./gradlew
FAILURE: Build failed with an exception.
What went wrong:
Could not open task artifact state cache (/opt/roofline/tool/.gradle/1.0-milestone-8/taskArtifacts).
java.io.IOException: No such file or directory
BUILD FAILED
==> You have to have write access for the directory you are trying to build in.
You have to have write access for the directory you are trying to build in