简体   繁体   中英

mvn works in cmd prompt but not in batch

I am trying to use mvn in a batch script and am encountering the following error when I run the script:

'mvn' is not recognized as an internal or external command, operable program or batch file.

However I am able to run mvn from the same directory when I simply use mvn clean install from the command prompt.

Info on system environment variables:

D:\Projects>echo %JAVA_HOME%
c:\Program Files\Java\jdk1.8.0_60
D:\Projects>echo %M2%
C:\Apps\apache-maven-3.3.3\bin
D:\Projects>echo %M2_HOME%
C:\Apps\apache-maven-3.3.3

Path:

C:\app\212482926\product\11.2.0\dbhome_1\bin;%GRADLE_HOME%\bin;C:\ProgramData\Oracle\Java\javapath;C:\oraclexe\app\oracle\product\11.2.0\server\bin;C:\Sybase\DataAccess\OLEDB\dll;C:\Sybase\DataAccess\ODBC\dll;C:\Sybase\OCS-12_5\lib3p;C:\Sybase\ADO.NET\dll;C:\Sybase\OLEDB;C:\Sybase\ODBC;C:\Sybase\OCS-12_5\dll;C:\Sybase\OCS-12_5\bin;C:\Program Files (x86)\Windows Resource Kits\Tools\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\apps\Cygwin\bin;C:\Apps\Tcl\bin;C:\Apps\perl\bin;%CSAM_SOCKADAPTER%bin;C:\PROGRA~2\CA\SC\CAM\bin;c:\Program Files\Java\jdk1.8.0_60\bin;C:\Program Files\TortoiseGit\bin;C:\Program Files (x86)\scala\bin;c:\apps\bin;c:\apps\lib;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;D:\typesafe-activator-1.3.10\activator-dist-1.3.10\bin;C:\Program Files (x86)\sbt\\bin;C:\apache-ant-1.9.6-bin\apache-ant-1.9.6\bin;%GROOVY_HOME%\bin;C:\%GRADLE_HOME%\bin;c:\Program Files (x86)\TextPad 4;C:\Ruby23-x64\bin;D:\gradle-2.13-bin\gradle-2.13\bin;C:\Windows\System32;C:\Program Files\nodejs\;C:\Program Files\SourceGear\Common\DiffMerge\;D:\apps\platform-tools-latest-windows\platform-tools;D:\apps\dependency-check\bin;C:\Program Files\7-Zip;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\nodejs\node_module\.bin;C:\Program Files (x86)\Microsoft VS Code\bin

I've also tried using both mvn clean install and call mvn clean install in the batch file with the same results.

Any help would be welcome - thanks!

mvn的路径添加到环境变量PATH

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