Jenkins, Gradle, clean works but compileJava fails (Permission Denied) - java

I am new to Jenkins and I would like to use it for my gradle project. I downloaded the gradle plugins for Jenkins, but when i try to build my app, I got
Building in workspace /home/alexi/Documents/workspace/testJenkins
[Gradle] - Launching build.
[testJenkins] $ /home/alexi/Documents/workspace/testJenkins/gradlew clean build test
:clean UP-TO-DATE
:compileJava
FAILURE: Build failed with an exception.
* What went wrong:
java.io.FileNotFoundException: /home/alexi/Documents/workspace/testJenkins/.gradle/2.13/taskArtifacts/cache.properties.lock (Permission denied)
> /home/alexi/Documents/workspace/testJenkins/.gradle/2.13/taskArtifacts/cache.properties.lock (Permission denied)
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.147 secs
Build step 'Invoke Gradle script' changed build result to FAILURE
Build step 'Invoke Gradle script' marked build as failure
Finished: FAILURE
I have tried to put chmod 777 to the .gradle directory, but I still got this error.
In my build steps, I have a new gradle step where I use the Gradle Wrapper and then make gradlew executable, I also check the field From Root Build Script Dir. The tasks I am executing are clean build test
Also, when I run those commands in Spring Tools SUite /Eclipse, it works perfectly, my Jenkins is on localhost

The solution was to remove the .gradle file already existing in my project (created with Spring Boot)

Related

ADD failed while integrating docker with jenkins

ADD target/maven-dev.jar maven dev.jar
ADD failed: file not found in build context or excluded by .dockerignore: stat target/maven-dev.jar: file does not exist
Build step 'Docker Build and Publish' marked build as failure
Finished: FAILURE
integrating docker with Jenkins.
how to solve this?

I have an error in my project when executing the command mvn verify -U

I am trying to build my project using maven, because I am using maven, as the title says, I am getting an error when I run the command mvn verify -U, in the terminal the following appears:
could not find artifact org.netbeans.api: org-netbeans-api-visual: jar: RELEASE731 in Central (https://repo1.maven.org/maven2)
To make it a little clearer I am going to attach a print screena

Maven: Failed to execute goal heroku:deploy-war

I am following this tutorial to create a sample project in IntelliJ Idea and deploy it in Heroku, but when I run the project
the Maven didn't built properly, giving me error:
Failed to execute goal com.heroku.sdk:heroku-maven-plugin:1.1.3:deploy-war (default-cli) on project helloworld: Failed to deploy application: Could not find app name: No 'heroku' remote found.
I solved it. The tutorial is missing one line. Before running this, we have to do
mvn clean install

Jenkins build cannot find resources but maven does

I am trying to setup Jenkins to automate project builds and I ran to the following problem. mvn clean install works perfectly from cmd but project build from jenkins fails when maven-antrun-plugin is being used.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run
(clientgen) on project Sample:
An Ant BuildException has occured: Compile failed; see the compiler error output for
details.
[ERROR] around Ant part ...<javac fork="yes" memoryInitialSize="512m"
destdir="E:\Jenkins\workspace\Trunk Builds\Sample\target/generated-sources"
memoryMaximumSize="1024m" srcdir="E:\Jenkins\workspace\Trunk Builds\Sample\target/build"
source="1.4" classpathref="maven.plugin.classpath" executable="C:\j2sdk1.4.2_19/bin/javac"
target="1.4"/>... # 46:428 in
E:\Jenkins\workspace\Trunk Builds\Sample\target\antrun\build-main.xml
Jenkins is actually unable to check for the packages imported when I use maven-antrun-plugin.
[javac] E:/Jenkins/workspace/Trunk Builds/Sample/target/build/ClassSample.java:20:
package org.sample.package does not exist
Whenever I do not use maven-antrun-plugin Jenkin build succeeds. Any ideas why even though it works through cmd jenkins fail to build the project?
Actually I found the real problem and found a workaround. The problem is that Jenkins did not access .m2/repository for some reason so I configured Jenkins to use local to workspace repository. Now it builds normally.

Failed to execute goal com.atlassian.maven.plugins:maven-amps-dispatcher-plugin

I try to set up helloworld plugin for jira and get the exception:
Failed to execute goal com.atlassian.maven.plugins:maven-amps-dispatcher-plugin:4.0:run (default-cli) on project helloworld: Unable to execute mojo: UnsupportedOperationException.....
My Environements:
JIRA - sdk-installer-4.0
java 1.6_0.32
maven 3.0.5(copy conf folder from sdk-installer-4.0 and paste into maven 3.0.5)
I clean .m2 local repository
Turn off Windows Defende
Try to set up project use this commands
atlas-clean
atlas-mvn eclipse:eclipse
atlas-compile
atlas-debug
But not result.
Have you any idea?
Thanks a lot

Categories