Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

1 build compatible for Windows and Linux agents

Charlie Misonne Community Leader Apr 21, 2016

I have a build plan that should run on any agent (Linux or Windows)


In the plan I have a Script Task which calls a script file on the server. For this I have to provide the filename of my script.

Script file is called gradlew for Linux and gradlew.bat for Windows. Both files are present in the working directory when checking out the git repo.

  • Linux: works fine
  • Windows: com.atlassian.utils.process.ProcessNotStartedException: ./gradlew could not be started

After some troubleshooting I replaced "gradlew" by "gradlew.bat" in the script task.
This worked! But not for linux of course

I thought using an inline script could solve the problem but then I would have to call /bin/sh gradlew on Linux which won't work on Windows again.

Any ideas how to handle this?

2 answers

Linux does not care about extension names, in the sense that they have magic meanings.  Rename gradlew to gradlew.bat on linux

Charlie Misonne Community Leader Apr 21, 2016

You mean the file itself in the working directory?

Can't really do that as gradlew.bat already exists for Windows. Both files are being checked out of GIT on each OS.


Charlie Misonne Community Leader Apr 21, 2016

yes, but then again. The sylmlink has to be created at the beginning of each build because we're starting from a clean directory. The ln command would work on Linux but throw an error on Windows

This might help, if the script using this trick is used the appropriate script.

I removed the symlink comment when I thought the same thing you did.  But, perhaps if the symlink was created by a different user (not as part of the build) and bamboo was not given permission to delete (chmod 755) it might work.  Sort of depends on how bamboo cleans directory.


Charlie Misonne Community Leader Apr 21, 2016

ok thanks for clarifying and your suggestion.

I will ask the developers using the build plan if that stackoverflow idea helps them out. I had another idea myself that might be easier but not ideal. Adding it in a minute

Bamboo has settings to clean or  not clean directories.  This may cause problems.  If so, adding a task to the script to clean directories instead of bamboo before the loading of the repository data might work.

0 votes
Charlie Misonne Community Leader Apr 21, 2016

What might work is adding a capability to each agent. For Windows agents the value would be .bat, for Linux agents it will be empty. Let's call it file.extension

In the script task we can set gradlew${bamboo.capabilities.file.extension}}} as file name


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Bamboo 7.1 is here and is packed with value!

I'm happy to announce that Bamboo 7.1 has been released and it’s overflowing with awesome new features. Top-voted issues First and foremost, a bunch of JAC top voted issues has been delivered - y...

703 views 1 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you