您的位置:首页 > 其它

nexus 搭建maven 私服

2019-06-02 07:01 1591 查看

下载地址

    https://www.sonatype.com/download-oss-sonatype

下载好之后解压

在bin目录下shift+右键

点击在此处执行命令行

输入命令

在地址栏输入:http://localhost:8081

就看到下面的页面

点击箭头所指地方登陆:账号admin  密码admin123

点击箭头所指地方就出现方框中的类型

type表示仓库类型:

类型    用途
hosted    表示当前开发人员上传的,包括snapshots快照版本/releases稳定版本/3rd party第三方包三种仓库;表示当前开发人员上传的,包括snapshots快照版本/releases稳定版本/3rd party第三方包三种仓库;
proxy    表示中央服仓库,包括snapshots快照版本/releases稳定版本两种仓库;

maven-central:maven中央库,默认从https://repo1.maven.org/maven2/拉取jar 
maven-releases:私库发行版jar 
maven-snapshots:私库快照(调试版本)jar 
maven-public:仓库分组,把上面三个仓库组合在一起对外提供服务,在本地maven基础配置settings.xml中使用。

maven-public

3.在maven的setting.xml的配置和项目中的运用!

  1. 对maven的配置文件setting的配置

一般会有一个公共仓库,和一个公司releases仓库,和一个快照仓库

<?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:\idea\apache-maven-3.5.3-bin\repository</localRepository>
<pluginGroups>
<pluginGroup>org.sonatype.plugins</pluginGroup>
</pluginGroups>
<proxies>
</proxies>
<servers>
<server>
<id>nexus</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://localhost:7777/repository/maven-public/</url>
</mirror>
</mirrors>

<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://localhost:7777/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://localhost:7777/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>

</profiles>

<activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>

 

在工程中使用 clean install deploy -X 发布工程到快照版本

(adsbygoogle = window.adsbygoogle || []).push({});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Nexus Maven