5

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

HFR1994
  • 153
  • 5

2 Answers2

4

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.

seanf
  • 266
  • 2
  • 6
  • "Something has probably messed with the line endings". I cloned the repo from windows and now I'm trying to build from WSL against my windows mounted drive. – spottedmahn Jan 23 '20 at 16:08
  • I had this same issue doing the exact same thing and this answer reminded me, git cli actually updates line endings based on which system you're on. – Chris Rollins Jan 29 '20 at 05:58
  • Notepad++ is also able to change line endings (Edit > EOL Conversion > Unix) – Ilya Serbis Jan 24 '21 at 21:34
0

In case that you are using IntelliJ, you can open mvnw file and in the right bottom corner you will probably have "CRLF". You can click on it and change it to "LF". See https://www.jetbrains.com/help/idea/configuring-line-endings-and-line-separators.html#line_ending