大网数据广告活动
服务器运维问答

WSL and maven wrapper?

· 52CE 我爱测

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 erro…

问题原文

原帖链接 · HFR1994 · CC BY-SA 4.0

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

已采纳解答

原帖链接 · seanf · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-08-06)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。