1.下载并解压maven和nexus.
2.配置maven的环境变量
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_33
MAVEN_HOME=F:\maven and nexus\apache-maven-3.0.4
PATH=%MAVEN_HOME%\bin
测试是否装好maven,可在命令行下执行mvn –v
3.启动nexus管理maven,nexus目录下的console-nexus.bat启动
或者先注册为windows服务install-nexus.bat,
然后启动服务start-nexus.bat
4.启动后url: http://localhost:8081/nexus
默认用户名密码:admin/admin123
在Views/Repositories-->Repositories里进行配置
将需要用到的repository的DownloadRemote Indexes 设置为true;
如我们这边设置了Central, ApacheSnapshots,
推荐一个proxyrepository: ibiblio
url: http://mirrors.ibiblio.org/maven/
Repair 和update index
eclipse maven2插件下载
http://m2eclipse.sonatype.org/sites/m2e
插件装好后设置如下:
setting.xml文件内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>F:\repo</localRepository>
<servers>
<server>
<id>nexus-snapshots</id>
<username>deployment</username>
<password>deployment</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<name>internal nexus repository</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
</settings>
设定完毕,用eclipse新建一个maven工程:
如果我们需要添加log4j的jar 包,可以在nexus中搜索log4j,选择所需的版本后,在右下方会有dependency的配置信息,
copy到工程中的pom中,则会自动下载jar到项目依赖中。
以上就是集成环境的搭建....