简体   繁体   中英

mvn - is not recognized as an internal or external command in Windows 11

I have downloaded binary mvn file, extracted it and added the MAVEN_HOME system variable and %MAVEN_HOME%\bin to path. https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.zip

I have tried multiple different directories, restarted PC multiple times and also ran cmd prmpt in administrator mode to eliminate any odds against me.

在此处输入图像描述

Update: I don't see the .cmd files after extraction. Files are present before extraction. Hidden files are enabled and when I create a .cmd file manually from mvn file, it still doesn't work. 在此处输入图像描述

Note: I have installed maven atleast in 10 other machines in the past. But never stuck as badly.

Solved it myself. Using the winRAR to extract the downloaded bin.zip file caused the problem. When accessed directly through winrar, the .cmd files (.bat in older version of maven) were present. 在此处输入图像描述 But after extracting to a folder, the files are missing. 在此处输入图像描述

Root Cause: For security reasons, WinRAR is omitting .cmd and .bat files from extraction list by default. 在此处输入图像描述

Using the default "Extract All.." option from right click menu resolved this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM