Windows Docker-Desktop builds Maven project and prompts sh mvnw: not found solution

Today, a project was pulled from the Docker official website and an error was reported when using Windows Docker Desktop to build a mirror image:
insert image description here

It's really bad, it's ok to test on a Mac. There is a big circle of Baidu and Google, some say it is a permission problem, some say it is a line break problem, after all, it is too troublesome! But I can be sure that the reason is almost the reason for the line break!

Solution:
Finally, I rebuilt a new Maven project through Ali's SpringBoot scaffolding, and took out the mvnw and other files inside to replace the files in the original project. The replacement list:

mvnw
mvnw.cmd
.mvn/

Then re-docker build... that's it!
As shown in the picture (in fact, in theory, only mvnw is needed, for the sake of insurance):
insert image description here

Guess you like

Origin blog.csdn.net/qq_25404477/article/details/129338290