Maven home(M2_HOME)未被IntelliJ IDEA接收 [英] Maven home (M2_HOME) not being picked up by IntelliJ IDEA

查看:1188
本文介绍了Maven home(M2_HOME)未被IntelliJ IDEA接收的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在OS X Lion上使用IntelliJ IDEA 10.5.1进行简单的maven构建,并收到以下错误:

I am trying to do a simple maven build with IntelliJ IDEA 10.5.1 on OS X Lion and am getting the following error:


运行my-app [package]时出错:找不到有效的Maven安装。
在配置对话框中设置主目录或在系统上设置
M2_HOME环境变量。

Error running my-app [package]: No valid Maven installation found. Either set the home directory in the configuration dialog or set the M2_HOME environment variable on your system.

我已将M2_HOME设置为以下内容,但我仍然遇到问题。是的,我确实重启了IntelliJ。

I have set M2_HOME to the following, but I am still having issues. And yes, I did restart IntelliJ.

$ echo $M2_HOME
/usr/share/maven

然后,我在IntelliJ的项目Maven设置中手动输入maven的路径。这不是我想要为每个项目做的事情,所以有什么我想知道如何让IntelliJ知道我的maven家在哪里?

I then manually entered the path to maven in IntelliJ's Maven Settings for the project. This is not something that I want to do for every project, so is there something I am missing with how to get IntelliJ know where my maven home is?

推荐答案

Mac OS应用程序无法读取bash环境变量。请查看此问题在OS X中设置环境变量?以公开 M2_HOME 包括IntelliJ在内的所有应用程序。执行此操作后,您需要重新启动。

Mac OS apps cannot read bash environment variables. Look at this question Setting environment variables in OS X? to expose M2_HOME to all applications including IntelliJ. You do need to restart after doing this.

这篇关于Maven home(M2_HOME)未被IntelliJ IDEA接收的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆