1、下载解压
http://download.csdn.net/detail/u013755987/8362735#comment
2、环境配置
(1)添加 M2_HOME 和 MAVEN_HOME 环境变量在Windows,并将其指向你的 Maven 文件夹。
(2)更新 PATH 变量,添加 Maven bin 文件夹到 PATH 的最后 – %M2_HOME%\bin, 这样就可以到处运行 Maven 命令了。
(3)验证安装:在命令行里输入mvn –version,显示了版本信息则表示安装成功。
3、在MyEclipse中创建第一个Maven项目:http://blog.sina.com.cn/s/blog_4f925fc30102epdv.html
(1)先要在MyEclipse中对Maven进行设置:
到此Maven对MyEclipse的支持设置完毕。
New --> Web Project
到此为止一个Maven标准的Web工程创建成功了。
添加Maven的标准目录:
右键单击项目名称-->New-->Source Folder
到此为止添加Maven的契约目录完毕。
右键单击项目名称-->Build Path-->Configure Build Path...
右键单击项目名称-->Maven4MyEclipse-->Update Project Configuration...
到此为止MyEclipse中创建的Maven工程的jdk版本更改完毕。
--------------------------------------------------------------------------------------------------
笔者这边多啰嗦一句,在用MyEclipse创建Maven工程的时候可能会碰到下面的这个问题:
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:
maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be
reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not
transfer artifact org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2 from/to central (http://
repo1.maven.org/maven2): No response received after 60000
【解决办法】:
--------------------------------------------------------------------------------------------------
笔者这边多啰嗦一句,在用MyEclipse创建Maven工程的时候可能会碰到下面的这个问题:
Failure to transfer org.apache.maven.plugins:maven-war-plugin:jar:2.1.1 from http://repo1.maven.org/maven2 was
cached in the local repository, resolution will not be reattempted until the update interval of central has
elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.plugins:
maven-war-plugin:jar:2.1.1 from/to central (http://repo1.maven.org/maven2): No response received after 60000
【解决办法】:
最后,测试一下
(1)跳转到刚刚创建的maven项目文件夹下面
(2)执行mvn compile可以编译项目
,这时在D:\WorkSpace\eclipse\ssh\mavenpro\target\classes文件夹下面将产生编译好的class文件,