I'm trying to run my ./mvnw from a Spring Boot project in a WSL (Ubuntu) with Windows 10 Enterprise Build 1803. But I keep getting the same error every time:

: not found ./mvnw:
: not found ./mvnw:
./mvnw: 53: ./mvnw: Syntax error: word unexpected (expecting "in")

Script works fine on a normal Linux server. In order to get a successful build I have to go to Powershell and run the same command ("./mvnw install dockerfile:build") and then return to my WSL and continue.

Command is to build a Docker image which later on is used on a Docker Compose.

Any ideas?

Thanks


Something has probably messed with the line endings in the mvnw script.

If you have dos2unix installed (sudo apt install dos2unix), you should be able to repair the script with dos2unix mvnw. Or just download it again.