Home > other >  CMD commands not working after executing maven command in command line
CMD commands not working after executing maven command in command line

Time:02-08

When i try to run this series of commands

cd \ && cd Users/gusenbauerM/IdeaProjects &
cd entities && rd /s /q target && mvn clean install -U && cd .. 

i get the following error from the last cd.. command

The command "cmd" is either misspelled or could not be found

My System Variables look like this:

JAVA_HOME    ->     C:\Program Files\Eclipse Foundation\jdk-11.0.12.7-hotspot
MAVEN_HOME   ->     C:\Program Files\apache-maven-3.8.4
M2_HOME      ->     C:\Program Files\apache-maven-3.8.4
PATH         ->     %MAVEN_HOME%\bin

Update

Like khmarbaise pointed out, i don't need the M2_HOME variable.

Also, I found out that the error is always displayed after running a Maven command, regardless of which one.

mvn -version

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: C:\Program Files\apache-maven-3.8.4
Java version: 11.0.12, vendor: Eclipse Foundation, runtime: C:\Program Files\Eclipse Foundation\jdk-11.0.12.7-hotspot
Default locale: de_AT, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
The command "cmd" is either misspelled or could not be found

CodePudding user response:

I found the solution to my problem. I did not add %MAVEN_HOME%\bin to the PATH variable (which replaced the actual one), i created a new PATH with variable, which only had the one value %MAVEN_HOME%\bin.

So Maven worked but i kinda broke everything else.

  •  Tags:  
  • Related