http://maven.apache.org/
http://m2eclipse.codehaus.org/Maven_2.0_Plugin_for_Eclipse.html
Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.
Maven安装配置:
1.在PATH后加上就XXXX/maven-2.0/bin;%PATH%,输入mvn –version验证。
2.如果是代理服务器上网就,setting.xml
3. 让我们看看创建一个简单的Java项目的例子。Maven使用原型来决定目录结构是如何展现的。Maven自带了几个内建的原型,您也可以自定义原型。
mvn archetype:create -DgroupId=com.oreilly -DartifactId=my-app
4. Compiling Application Sources
输入:cd my-app;
mvn compile
5. Compiling Test Sources and Running Unit Tests
mvn test;
mvn test will always run the compile and test-compile phases first, as well as all the others defined before it.
6. Packaging and Installation to Your Local Repository
Making a JAR file is straightforward and can be accomplished by executing the following command:
C:/mvnbook/my-app> mvn package
Now, you'll want to install the artifact (the JAR file) you've generated into your local repository. It can then be used by other projects as a dependency. The directory
To install, execute the following command:
C:/mvnbook/my-app> mvn install
7. Maven2 for eclipse 的插件
http://m2eclipse.codehaus.org/update/
注意:安装plugin时,如果上网是浏览器代理则eclipse也要设置一下,才能联上网
windows->preferences->install/upadate选择Enable HTTP proxy connection
8.进入项目目录,输入:mvn eclipse:eclipse
生成eclipse项目形式.
9. 在eclipse中导入openfans的时候,需要设置Maven的资源目录,
默认目录C:/Documents and Settings/pengch/.m2/repository
具体设置方式如 下:
1.运行eclipse
2.window-->references-->Java-->build path-->classpath variables
3.按"New",名字为:M2_REPO 创建一个目录,指向C:/Documents and Settings/pengch/.m2/repository
OK
如果你希望把安装后的maven2的数据仓库指向其他文件夹,你可以在E:/maven/conf下面找到一个settings.xml文件,打开该文件,找到下面的结点进行修改
修改M2_REPO属性为E:/maven/.m2/repository
10.修改 setting.xml文件中的
点击browse后找到setting.xml点击reindex local repostiory就可以了。