简体   繁体   English

安装Maven 3后无法识别mvn

[英]mvn is not recognized after installation Maven 3

I have some problems with my maven 3 installation. 我的maven 3安装有一些问题。

I have downloaded maven 3.0.3 and extracted it to a folder. 我已经下载了maven 3.0.3并将其解压缩到一个文件夹中。 I set the following environment variables. 我设置了以下环境变量。

  • M2_HOME: M2_HOME:
    C:\\a few folders\\apache-maven-3.0.3
  • M2: M2:
    %M2_HOME%\\bin
  • JAVA_HOME: JAVA_HOME:
    C:\\Program Files\\Java\\jdk1.6.0_25
  • Path: 路径:
    %JAVA_HOME%\\bin; %M2%

I get a message that the command is not recognized when i type "mvn" in the command line. 我收到一条消息,当我在命令行中输入“mvn”时,无法识别该命令。 Any ideas? 有任何想法吗?

Maven 3.0.3 and later doesn't need the M2_HOME variable. Maven 3.0.3及更高版本不需要M2_HOME变量。 The following environment variable changes are sufficient to run Maven from the command-line: 以下环境变量更改足以从命令行运行Maven:

  1. Setting JAVA_HOME to the Java jdk directory (eg. C:\\Program Files\\Java\\jdk1.6.0_29 ) JAVA_HOME为Java jdk目录(例如, C:\\Program Files\\Java\\jdk1.6.0_29
  2. Setting PATH to include the Maven bin directory. PATH设置为包含Maven bin目录。

Everything looks OK. 一切都很好看。

  • I don't know if there should be a space after the semicolon and %M2% . 我不知道分号和%M2%之后是否应该有空格。 This might be your problem. 这可能是你的问题。
  • Make sure you typed a "a few folders" correctly. 确保正确键入“几个文件夹”。

Try this: 试试这个:

Add(create) these new variables at the SYSTEM VARIABLES (M3_HOME and M3): 在SYSTEM VARIABLES(M3_HOME和M3)中添加(创建)这些新变量:

 M3_HOME: C:\maven_installation_folder\

 M3: %M3_HOME%\bin

Include at: "CLASSPATH" and "Path" variables 包含在:“CLASSPATH”和“Path”变量

 CLASSPATH: other_variables;%M3%;

 Path: other_variables;%M3%;

Go to Command Prompt (cmd) and type: 转到命令提示符(cmd)并键入:

 mvn -version

Maven 3.0.3 and later doesn't need the M2_HOME variable. Maven 3.0.3及更高版本不需要M2_HOME变量。 So no need to add that. 所以不需要添加它。

I did the following in the Windows System variables and it works: 我在Windows系统变量中执行了以下操作,它可以工作:

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_31
Path=C:\Program Files\Java\jdk1.8.0_31\bin;C:\Selenium 3\Maven\apache-maven-3.3.3\bin

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Maven安装后出现问题-mvn安装尝试下载无法访问的文件 - Problems after Maven installation - mvn install tries to download unreachable files 即使在我将 Maven 设置为主页并配置 Jenkins Maven 安装程序后,“mvn”也不会被识别为内部或外部命令? - 'mvn' is not recognized as an internal or external command even after I set Maven home and configure Jenkins Maven Installer? Maven 和 Jenkins - 'mvn' 不被识别为内部或外部命令, - Maven and Jenkins - 'mvn' is not recognized as an internal or external command, Maven构建出错:mvn.bat无法识别 - Error in Maven build: mvn.bat not recognized Maven 帮助,mvn 未被识别为内部/外部命令 - Maven Help, mvn is not recognized as an internal/external command Maven 默认生命周期不被 mvn 识别 - Maven default life cycle not recognized by mvn 设置操作系统环境变量后,Apache Maven安装“'mvn'无法识别为内部或外部命令”吗? - Apache Maven install “'mvn' not recognized as an internal or external command” after setting OS environmental variables? 设置OS环境变量后,Apache Maven安装“'mvn'不被识别为内部或外部命令”? - Apache Maven install “'mvn' not recognized as an internal or external command” after setting OS environmental variables? Spring和Maven插件安装问题; MVN; 弹簧 - Spring and Maven plugin installation issue; mvn; spring 未找到 Maven 3.0.4 安装到 Ubuntu mvn - Maven 3.0.4 installation to Ubuntu mvn not found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM