I try to run gradlew on my Umbutu Linux server using the command sudo sh gradlew tasks
I get the following error: gradlew: 158: gradlew: Syntax error: "(" unexpected
Gradle Version: 3.0
Operating System: Umbutu Linux 14.04.4
Is this a regression? No If yes, which version of Gradle do you know it last worked for?
Can you try doing “sudo ./gradlew tasks”? The gradlew script is typically a Bash script, and I’m not sure what it would do if run from Bourne shell (I couldn’t get this error in my own testing).
I assume you have a specific reason for sudoing that.
I think the main problem would be that on Ubuntu, by default, the root shell is Dash - which is not Bash compliant. Our gradlew shell script does not yet support that. There is an open pull request to add support, but it has been stalled for some time.
To fix your problem it would probably be enough to run