Reputation: 535
I am trying to create a Jenkins agent for building gradle lambda projects. Jenkins agent is throwing the below error while building the project.
Exception in thread "main" java.lang.RuntimeException: Could not create parent directory for lock file /gradle/wrapper/dists/gradle-4.2.1-bin/dajvke9o8kmaxbu0kc5gcgeju/gradle-4.2.1-bin.zip.lck
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:43)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
/home/jenkins/workspace/ddoa-subprod/lf-security-gateway2/lf-security-gateway2
FAILURE: Build failed with an exception.
* What went wrong:
Failed to load native library 'libnative-platform.so' for Linux amd64.
Please help me in understanding the issue and let me know how to fix the same.
Upvotes: 4
Views: 4043
Reputation: 17336
To fix this error: What went wrong: Failed to load native library 'libnative-platform.so' for Linux amd64.
do the following:
libnative-platform.so
exists in that directory or not).chmod -R 755 ~/.gradle
is enough).IF you don't see native folder at all or if your native folder seems corrupted, run your Gradle task ex: gradle clean build
using -g
or --gradle-user-home
option and pass it's value.
Ex: If I ran mkdir /tmp/newG_H_Folder; gradle clean build -g /tmp/newG_H_Folder
, you'll see Gradle will populate all the required folder/files (that it needs to run even before running any task or any option) are now in this new Gradle Home folder (i.e. /tmp/newG_H_Folder/.gradle directory).
From this folder, you can copy - just the native folder to your user's ~/.gradle folder (take backup of existing native folder in ~/.gradle first if you want to) if it already exists -or copy the whole .gradle folder to your ~ (home directory).
Then rerun your Gradle task and it won't error out anymore.
Gradle docs says: https://docs.gradle.org/current/userguide/command_line_interface.html
-g, --gradle-user-home Specifies the Gradle user home directory. The default is the .gradle directory in the user’s home directory.
Note: using gradle <sometask> -g <a_dynamic_folder_ex_jenkins_workspace>
will always work as Gradle will create fresh .gradle cache in that -g
defined folder, but doing this, it'll not reap the true benefit of Gradle's cache concept.
Upvotes: 3
Reputation: 28126
If you are using a version 3.4 if Gradle, then it could possibly be this issue.
To fix it, you can try to update your Gradle distribution to version 3.5 or higher, where this issue was solved.
Upvotes: 1