使用maven编译Sonatype Nexus源码

首先需要使用git客户端从github下载nexus的最新源码:https://github.com/sonatype/nexus

因为nexus本身就是一个非常复杂的maven项目,因为我们只能使用maven来编译。如果我直接编译,nexus就会报各种找不到包的错误。

原因是我们需要把nexus官方的一个仓库加入到maven的settings文件中。代码为:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  

sonatype-forge


sonatype-forge
http://repository.sonatype.org/content/groups/forge/

true


true





sonatype-forge
http://repository.sonatype.org/content/groups/forge/

true


true






sonatype-forge

然后再次编译,就应该可以构建成功了。由于nexus的仓库在国外,个人感觉速度比maven中央仓库要慢一个等级。在编译过程中,maven会自动执行一些插件和完成相关的单元测试。大概等待1-2个小时左右(由电脑性能和网络决定),就可以编译完成了。