cmd 輸入 mvn -v 不是內部命令 No goals have been specified for this build
安裝Maven
現象:解壓到安裝目錄之後 配置完環境變數之後 cmd執行 mvn -v 報錯 No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
解決方法 找到maven安裝路徑下lib\maven-model-builder-x.x.x.jar開啟,編輯pom.xml檔案,在第一個build後新增<defaultGoal>compile</defaultGoal>
記得儲存(先用winrar解壓檔案 找到pom.xml 更改後拖動到jar檔案對應位置)
前置條件 1、maven zip包下載並解壓完畢 2、環境變數不殘缺 MAVEN_HOME環境變數 JAVA_HOME環境變數 CLASS_PATH環境變數 Path環境變數:(本人的) %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;D:\Program Files\node\;D:\Program Files\Git\cmd\;%MAVEN_HOME%\bin\;