版权声明:本文为王小雷原创文章,未经博主允许不得转载 https://blog.csdn.net/dream_an/article/details/49274339
MAVEN学习笔记之私服Nexus(2)
代码语言:javascript复制私有服务器搭建
Nexus
www.snatype.org下载
snatype-work 是默认nexus存储nexus
a:将bin添加到环境中 Adminisrator path
b:修改java的绝对路径
文件binjswconfigwrapper.config
内容wrapper.java.command=E:IDEJavaJDKbinjava
c:cmd中 nexus install ;nexus start
localhost:8081/nexus
login
user:admin
pass:admin123
jqury类网站
http://www.datatables.net/
2.0 nexus
常用工厂 group hosted hosted 三大工厂
三大工厂简介
mvn:deploy 提交命令
group控制都个工厂
第一种 pom.xml(不推荐)
<repositories>
<repository>
<id>nexus</id>
<name>Nexus Repoitory</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<--!snapshots默认是关闭的需要手动开启!-->
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
第二种 maven文件走中配置(推荐) 是的所有maven项目使用nexcus
setting.xml
增加如下内容:
<profile>
<id>nexusRepo</id>
<repositories>
<repository>
<id>nexusProfile</id>
<name>Nexus Repoitory</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<--!snapshots默认是关闭的需要手动开启!-->
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
<activeprofiles>
<!--只有激活才生效--!>
<activeprofiles>nexusProfile</activeprofiles>
</activeprofiles>
第三种 配置镜像(更推荐)
<!--工厂的镜像,只要mirrorof中的工厂要访问,都会自动来找镜像,
如果镜像无法访问则不会再访问中央工厂,使用*表示所有的工厂都来这个镜像访问,推荐使用-->
<mirror>
<id>nexusMirror</id>
<mirrorof>*</mirrorof>
<name>Human Readable Name for this Mirror</name>
<url>http://localhost:8081/nexus/content/groups/public/</url>
</mirror>
</mirror>
<profile>
<repositories>
<repository>
<id>central</id>
<name>central Repoitory</name>
<url>http://*</url>
<layout>default<layout>
<--!snapshots默认是关闭的需要手动开启!-->
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
发布工厂
<distributionManagement>
<repoaitory>
<id>user-release</id>
<name>user release res</name>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repoaitory>
<snapshotRepoaitory>
<id>user-snapshots</id>
<name>user release res</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepoaitory>
</distributionManagement>
需要授权(学习网址http://www.icoolxue.com/play/718)
mavensetting.xml
<server>
<id>user-release</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>user-snapshots</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>
添加私有工厂
增加hosted是
release
ADD-->ID Name Type
再增加hosted
snapshots
添加权限 release snapshots
name cmsprivilege
all
组织机构管理
a:添加角色
Roles-->Add-->ID NAME ADD(ALL)
b:添加用户
Users-->Add (Nexus User)-->ID Name Activie Add(cms role)
最后修改
setting.xml
pom.xml url