系统使用的系统为win7系统。
1.下载nexus
从官网下载最新版本,下载地址http://www.sonatype.org/nexus/ ,我下载后的压缩包为,将解压后的文件放在F盘(目录可自己选择,最好不要放在系统盘,以免系统恢复时麻烦),解压后的目录如图所示:
文件夹说明:
nexus-2.10.0-02:该文件夹包含了nexus运行需要的文件,如启动脚本、依赖jar包等,该文件夹是非常重要的。
sonatype-work:该文件夹包含了nexus生成的配置文件、日志文件、仓库文件等。
(2)Bundle方式安装nexus
配置环境变量:
新建系统变量,如图:
其中变量值为nexus-2.10.0-02文件夹路径,我的变量值为F:\nexus-2.10.0-02-bundle\nexus-2.10.0-02。
path环境变量中添加如下值:环境变量path值最前面加入如下地址:%NEXUS_HOME%\bin;
在cmd下启动nexus服务:ce 路径 /bin nexus.exe/run 启动 nexus
(3)设置nexus
访问路径http://localhost:8081/ Login默认的账号/密码为:admin/admin123
添加第三方库 选择Maven2(hosted)
按照系统设置第三方jar库属性
将第三方库添加到maven-public组策略中
(4)第三方库上传jar包步骤
(5)设置maven setting.xml
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<!--设置镜像 规定maven中央库的jar包必须从nexus私有库中取得-->
<mirror>
<id>nexusMirror</id>
<name>all repository of public thirdparty releases</name>
<mirrorOf>central</mirrorOf>
<url>http://localhost:8081/repository/maven-public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>dev</id>
<repositories>
<repository>
<id>nexus</id>
<url>http://localhost:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http://localhost:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>