2012年的时候,我准备下载spring框架的源码及项目看看,没想导入eclipse报错,于是开启了maven学习之路。继而突然一瞬间发现,许多牛b的项目都变成了maven项目了。
当前最新


(一)maven安装
1.下载解压 目录为 f:\program files\apache-maven-3.0.5
2.添加环境变量m2_home为f:\program files\apache-maven-3.0.5
3.设置环境变量path末尾加上%m2_home%\bin注意使用;号隔开
检测:

4. 当前可选步骤 修改conf目录下settings.xml <localrepository> 标签,设置maven下载依赖包位置如f:\maven2-repository\repository,默认为用户文档目录.m2下如 d:\我的文档\.m2\repository
<!-- localrepository
| the path to the local repository maven will use to store artifacts.
|
| default: ~/.m2/repository
<localrepository>/path/to/local/repo</localrepository> -->
5. 当前可选步骤 版本切换修改 m2_home 指定,如设置为f:\program files\apache-maven-2.2.1即可
6. 当前可选步骤 添加 maven_opts 指定,指定jvm运行时内存-xms128m -xmx512m,如果其他位置运行,如ide设置了这可以不设
7. 当前可选步骤 设置代理:
<proxies>
<!-- proxy
| specification for one proxy, to be used in connecting to the network.
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonproxyhosts>local.net|some.host.com</nonproxyhosts>
</proxy>
-->
</proxies>
ok,以上为安装maven及其简单配置
(二)maven的eclipse插件安装m2eclipse
1.首先谈下依赖,怎么下插件? help --> install new software
m2eclipse-core插件 ——依赖——>gef插件
m2eclipse-extras插件 ——依赖——>subclipse插件
2.gef 插件地址:
<a target="_blank" href="http://download.eclipse.org/tools/gef/updates/interim/">http://download.eclipse.org/tools/gef/updates/interim/</a>
3.subclipse 插件地址:
(用于svn)
<a target="_blank" href="http://subclipse.tigris.org/update_1.6.x">http://subclipse.tigris.org/update_1.6.x</a>
m2eclipse-extras 中有些组件是可选的
如maven scm hander for subclipse maven scm
integration 这是给svn的
maven scm
hander for team/cvs 这是给svn的 cvs
maven integration
for wtp 这是eclipse自动读取pom的
...support一般不会用到,而起里面有些好像很难下下来,依赖不明,可以去掉一些组件下载就顺畅了
5.插件配置
eclipse启动配置文件 eclipse.ini
-vm
c:/progra~1/java/jdk1.5.0_17/jre/bin/javaw.exe
--launcher.xxmaxpermsize
256m
-vmargs
-dosgi.requiredjavaversion=1.5
-duser.name=tanx
-xms128m
-xmx512m
某些顺序什么的可以调下,然后就是 确定好jdk,maven不能是jre的,确定好内存大小,注意我的jdk路径,有些是progra~2神马据传是64位系统的,当然你的jdk没空格更好了。
6.还没结束噢

插件会内嵌一个maven,但是当然我们应该用自己的,有一个全局的setting.xml当是看到user setting没,我觉得可以不讲了。8