Hi,
I'm wondering how to build a Java code repository with Gradle using Bitbucket pipelines.
I've currently got this code, but the build is always failing:
# This is a sample build configuration for Gradle. # Check our guides at https://confluence.atlassian.com/x/VYk8Lw for more examples. # Only use spaces to indent your .yml configuration. # ----- # You can specify a custom docker image from Docker Hub as your build environment. image: java:8 pipelines: default: - step: script: # Modify the commands below to build your repository. - gradlew --version - gradlew build
I've also have the gradlew.bat and gradlew file in my repository and in the folder gradle under wrapper the gradle-wrapper.jar (and some scripts to be executed from the build.gradle).
Because I want to try Bitbucket pipelines on my Minecraft Mod out, gradle would also have to download some stuff to be able to compile the src code.
Currently it works all well on my local Windows machine, but on Bitbucket I'm getting the following error:
bash: gradlew: command not found
Hey @MinecraftPlaye,
The gradlew is a script so you will need to execute it like a script.
Try:
pipelines: default: - step: script: # Modify the commands below to build your repository. - ./gradlew --version - ./gradlew build
Let me know how that goes
Sadly, it does not work:
bash: ./gradlew: Permission denied
Hm, wat I'm wondering, if it dienies me the permission to do that, will it denie me the permission to change a file with the gradlew setup (actually, after building it increases the version number automatically in the build.properties file )
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I just did some changes after some research: I added the bash keyword before every single of the two commands and now it's working.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great to hear it's working!
Another workaround for the permission denied is to commit the gradlew file with executable permissions.
http://stackoverflow.com/questions/17668265/gradlew-permission-denied
To make a file executable in Windows maybe try http://stackoverflow.com/questions/21691202/how-to-create-file-execute-mode-permissions-in-git-on-windows
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Here is my gradle script, to build and create EAR file for my project.
# You can specify a custom docker image from Docker Hub as your build environment. image: qlik/gradle pipelines: default: - step: script: - gradle clean - gradle test - gradle ear
Previously above script was working perfect (i was getting my ear ) from last two months , but today when i start build, it fails on clean command i.e
gradle clean
+ gradle clean
/tmp/bashScript853752692724365978.sh: line 22: gradle: command not found
+ gradle clean
/tmp/bashScript853752692724365978.sh: line 22: gradle: command not found
Can any body help me ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Kashif-Ur-Rehman can you rerun that Pipeline? Is that issue still occurring?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Philip Hodder, yes , i rerun this yesterday and today, and now it is working fine.
I dont know reason, that why same script was not running previous week ..
Do you have any idea ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My apologies @Kashif-Ur-Rehman. That was a bug that we accidentally introduced into the system last week. Specifically, we made a change to the way that we mount volumes inside the Docker container of your pipeline. We were able to detect, revert, and fix the issue before it was exposed to most of our users, but you seem to have unfortunately been affected by it.
Your script itself was not the problem and you should not encounter this issue anymore.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh I see, BTW, previous week I was changing my script with different docker images, I thought may be docker image got change, but it was not.
Any how, thanks for detailed explanation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Im am also experiencing this issue in some of our Pipeline branches:
/opt/atlassian/pipelines/agent/tmp/bashScript2757741404473080195.sh: line 16: grails: command not found
Is there a way how I can fix this by myself @Philip Hodder?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It should be fixed for you too now. But if not (let me know if you're still seeing it), installing dependencies (such as grails) as part of you pipeline, or burning them inside your Docker image, should be a sufficient work around.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello everybody!
I've recently gotten the same issue. 3 weeks ago my pipeline was working and now it throws an error message "bash: gradle: command not found". @Philip Hodder is this problem similar to the previous ones?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.