mvn --version -Dmaven.multiModuleProjectDirectory 系统属性未设置

mvn --version -Dmaven.multiModuleProjectDirectory 系统属性未设置

我已经在 uBuntu 14.04 上下载并安装了 maven3.3.3。当我运行命令时

mvn --version

我收到这个错误

-Dmaven.multiModuleProjectDirectory system propery is not set. Check $M2_HOME `enter code here`environment variable and mvn script match.

我尝试在 /etc/environment 中设置环境

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/apache-maven-3.3.3/bin"

JAVA_HOME="/usr/lib/jvm/java-8-oracle/jre"

MAVEN_OPTS="-Xms1024m -Xmx2048m -Dmaven.surefire.debug=-Xmx2048m -XX:MaxPermSize=128m"

M2_HOME="/opt/apache-maven-3.3.3"

对你的帮助表示感谢

G

答案1

在终端中

./mvn -Dmaven.multiModuleProjectDirectory=$M2_HOME --version

在 Eclipse 中

Window > Preferences > Java > Installed JREs > Edit

将下面的行添加到默认 VM 参数

-Dmaven.multiModuleProjectDirectory=$M2_HOME

默认情况下,无需执行任何操作:

cd
wget http://www.gtlib.gatech.edu/pub/apache/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz
tar xf apache-maven-3.3.3-bin.tar.gz
cd apache-maven-3.3.3/bin
./mvn --version

示例输出

$ ./mvn --version
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00)
Maven home: /home/aboettger/Downloads/apache-maven-3.3.3
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-i386/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "3.19.0-21-generic", arch: "i386", family: "unix"

相关内容