首页 > 代码库 > Eclipse配置Maven

Eclipse配置Maven

1.软件环境

Eclipse Juno Service Release 2
 

2.Eclipse配置Maven

(1)Help -> Install New Software... -> Add  输入对应的值
> Name = m2e(这个值随意)
> Location = http://download.eclipse.org/technology/m2e/releases
技术分享
(2)勾上所有的Maven Integration for Eclipse,点击Next
技术分享
此时会有如下的错误:
技术分享
错误信息:
Your original request has been modified.
  "m2e - Maven Integration for Eclipse (includes Incubating components)" is already installed, so an update will be performed instead.
  "m2e - slf4j over logback logging (Optional)" is already installed, so an update will be performed instead.
Cannot complete the install because one or more required items could not be found.
  Software being installed: m2e - slf4j over logback logging (Optional) 1.5.0.20140606-0033 (org.eclipse.m2e.logback.feature.feature.group 1.5.0.20140606-0033)
  Missing requirement: Maven Integration for Eclipse 1.5.0.20140606-0033 (org.eclipse.m2e.core 1.5.0.20140606-0033) requires ‘bundle com.google.guava [14.0.1,16.0.0)‘ but it could not be found
  Cannot satisfy dependency:
    From: Maven Integration for Eclipse 1.5.0.20140606-0033 (org.eclipse.m2e.core.ui 1.5.0.20140606-0033)
    To: bundle org.eclipse.m2e.core [1.5.0,1.6.0)
  Cannot satisfy dependency:
    From: m2e logback appender 1.5.0.20140606-0033 (org.eclipse.m2e.logback.appender 1.5.0.20140606-0033)
    To: bundle org.eclipse.m2e.core.ui [1.5.0,1.6.0)
  Cannot satisfy dependency:
    From: m2e - slf4j over logback logging (Optional) 1.5.0.20140606-0033 (org.eclipse.m2e.logback.feature.feature.group 1.5.0.20140606-0033)
    To: org.eclipse.m2e.logback.appender [1.5.0.20140606-0033]
 
导致这个插件无法安装,这是因为这个插件版本过高导致的,我们需要在重新选择插件版本,如下图,我们将Show only the latest versions of available software,然后选择1.4版本的即可
技术分享
 
(3)然后一路按照提示.Next即可,装完后,他会提示重启Eclipse,重新启动就可以了!
(4)重启Eclipse后,选择Windows -> Preferences -> Maven -> Installations
(5)点击Add,选择我们自己的Maven路径,将他与Eclipse插件关联起来,点击Apply
技术分享
(6)选择Maven -> User Settings,设置User Settings为我们的Maven目录下的conf目录下的settings.xml文件即可,点击Apply
技术分享
(7)到此为止,Eclipse上的Maven插件就配置好了,就可以创建Maven工程了。

Eclipse配置Maven