1、安装jdk1.6
2、设置环境变量
2.1 添加变量:变量名:JAVA_HOME;变量值:C:\Program Files\Java\jdk1.6.0_43
2.2 编辑path:在后面添加%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin(如果添加前最后面没有;则要加上;)
2.3 添加变量:变量名:classpath;变量值: .;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar
3、解压maven
4、设置环境变量
4.1 添加变量:变量名:M2_HOME;变量值:D:\java\software\apache-maven-3.0.5
4.2 编辑path:在后面添加%M2_HOME%\bin(如果添加前最后面没有;则要加上;)
5.eclipse中m2eclipse插件的安装
Eclipse默认不支持Maven。需要给它添加m2eclipse插件。下面是具体的操作步骤。
依次选择Eclipse菜单栏的“Help”菜单à“Instance NewSoftWare”菜单项,就会弹出如下对话窗口:
选择“Add..”按钮,又会弹出如下对话框:
这个对话框就是用于添加一个插件地址的。在“Name”对应的输入框里输入该操作的一个标识名。在“Location”对应的输入框里输入这个插件的安装地址。注:Maven的Eclipse插件地址为:http://download.eclipse.org/technology/m2e/releases。输入后,如下图所示:
输入完成后,点击右下角的“OK”按钮,就会弹出如下对话框:
这里需要选择想要安装的插件的详细内容。选中“Maven Integration for Eclipse”前面的复选框。如下图所示:
选择完成后,点击右下方的“Next>”按钮进行安装。安装成功后,会提示需要重启Eclipse来生效这次配置。重启之后,这个Eclipse就可以使用m2eclipse插件功能了。
在安装过程中,可能会出现以下错误。
出错 1:
Cannot complete the install because one or more required items could not be found.
Software being installed: m2e - Maven Integration for Eclipse (includes Incubating components) 1.5.2.20150413-2215 (org.eclipse.m2e.feature.feature.group 1.5.2.20150413-2215)
Missing requirement: Maven Integration for Eclipse 1.5.2.20150413-2215 (org.eclipse.m2e.core 1.5.2.20150413-2215) requires 'bundle org.slf4j.api 1.6.2' but it could not be found
Cannot satisfy dependency:
From: m2e - Maven Integration for Eclipse (includes Incubating components) 1.5.2.20150413-2215 (org.eclipse.m2e.feature.feature.group 1.5.2.20150413-2215)
To: org.eclipse.m2e.core [1.5.2.20150413-2215]
- Help -> Install New Software...
- Work with填写:http://www.fuin.org/p2-repository/ -> 回车,需要一段时间加载列表 -> 搜索框填写slf,然后按如下图勾选 -> Next...即可
- 过程中可能提示重启,重启后再去安装m2e插件即可。
注意:提示缺少1.6.2,这里安装1.6.6是没问题的。
错误2:bundle com.google.guava[14.0.1,16.0.0)
Cannot complete the install because one or more required items could not be found.
Software being installed: m2e - Maven Integration for Eclipse (includes Incubating components) 1.5.0.20140606-0033
(org.eclipse.m2e.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: m2e - Maven Integration for Eclipse (includes Incubating components) 1.5.0.20140606-0033 (org.eclipse.m2e.feature.feature.group 1.5.0.20140606-0033)
To: org.eclipse.m2e.core [1.5.0.20140606-0033]
解决办法 :安装M2e 1.4版本
地址
http://download.eclipse.org/technology/m2e/milestones/1.4