Maven与Nexus配置
Table of Contents
1 Nexus部分
1.1 安装
1.2 运行
1.3 配置
2 maven部分
2.1 maven安装
2.2 maven配置
1 Nexus部分
1.1 安装
nexus服务器下载路径:
/nexus/go
安装过程:
t a r x v f n e x u s-2.0.1-b u n d l e.t a r.g z
其中解压出两个文件夹:nexus-2.0.1以及sonatype-work。将这两个文件都拷贝到
$HOME_PATH/Development/Resource下
1.2 运行
b i n/n e x u s s t a r t
此时有可能会提示错误,说nexus.pid无法创建云云,不用管他,nexus 应已正常启动。我们可以点击127.0.0.1:8080/nexus/
1.3 配置
我们可以在网页环境下对nexus进行配置。nexus使用了ajax技术,交互性能非常好,上手很容易。
值得注意的是,nexus的管理员用户名为admin,密码却为admin123。千万不要混淆了。
2 maven部分
2.1 maven安装
maven的下载地址为
/download.html
安装步骤如下:
t a r x v f a p a c h e-m a v e n-3.0.4-b i n.t a r.g z
m v a p a c h e-m a v e n-3.0.4/o p t
要注意我们还要在环境变量中添加maven的路径,然后注销以生效。
完成上述工作后我们可以运行命令mvn -version来检查是否设置成功。
上述文件会创建~/.m2的目录哦。如果我们要配置l,可以在这儿配置。 当然,默认是没有这个文件的。
2.2 maven配置
修改l文件的内容为
1:  <settings>
2:  <mirrors>
3:  <mirror>
4:  <!--This sends everything else to /public -->
5:  <id>n e x u s</id>
6:  <mirrorOf>*</mirrorOf>
7:  <url>h t t p://127.0.0.1:8081/n e x u s/c o n t e n t/g r o u p s/p u b l i c</url>
8:  </mirror>
9:  </mirrors>
10:  <profiles>
11:  <profile>
12:  <id>n e x u s</id>
13:  <!--Enable snapshots for the built in central repo to direct -->
14:  <!--all requests to nexus via the mirror -->
15:  <repositories>
16:  <repository>
17:  <id>c e n t r a l</id>
18:  <url>h t t p://c e n t r a l</url>
19:  <releases><enabled>t r u e</enabled></releases>
20:  <snapshots><enabled>t r u e</enabled></snapshots>
21:  </repository>
22:  </repositories>
如何配置maven环境变量23:  <pluginRepositories>
24:  <pluginRepository>
25:  <id>c e n t r a l</id>
26:  <url>h t t p://c e n t r a l</url>
27:  <releases><enabled>t r u e</enabled></releases> 28:  <snapshots><enabled>t r u e</enabled></snapshots> 29:  </pluginRepository>
30:  </pluginRepositories>
31:  </profile>
32:  </profiles>
33:  <activeProfiles>
34:  <!--make the profile active all the time -->
35:  <activeProfile>n e x u s</activeProfile>
36:  </activeProfiles>
37:
38:  <!-- 设置发布时的用户名 -->
39:  <servers>
40:  <server>
41:  <id>n e x u s-r e l e a s e s</id>
42:  <username>a d m i n</username>
43:  <password>a d m i n123</password>
44:  </server>
45:  <server>
46:  <id>n e x u s-s n a p s h o t s</id>
47:  <username>a d m i n</username>
48:  <password>a d m i n123</password>
49:  </server>
50:  </servers>
51:
52:  </settings>
Date: 2012-03-12 19:58:57 CST
Author: Darian Wang
Org version 7.8.03 with Emacs version 24
Validate XHTML 1.0