M2_HOME和MAVEN_HOME有什么区别

M2_HOME和MAVEN_HOME有什么区别

问题描述:

我有两个版本的maven home环境变量-M2_HOMEMAVEN_HOME.

I have two version of environment variables for maven home - M2_HOME and MAVEN_HOME.

需要设置哪个?

MAVEN_HOME适用于Maven 1,M2_HOME适用于Maven 2及更高版本.

MAVEN_HOME is for Maven 1, M2_HOME is for Maven 2 and later.

Maven 2是对Maven 1的完全重写,并且不向后兼容.拥有两个不同的_HOME变量意味着可以在同一台计算机上同时运行这两个变量.

Maven 2 was a complete rewrite from Maven 1 and was not backwards compatible. Having the two different _HOME variables means it is possible to run both on the same machine.

更新

从maven 3.5.0开始,这些环境变量都不应该指定.相反,应该更新路径以包含mvn可执行文件.

As of maven 3.5.0 neither of these environment variables should be specified. Instead, the path should be updated to include the mvn executable.