1.首先,配置好Maven,jdk等必备环境
2.配置好环境后,下载最新版本的nexus
下载地址:http://www.sonatype.org/nexus/go
3.打开目录nexus-***\bin\jsw
这个文件夹下面有适配各种平台的nexus服务配置工具。
大家可以根据自己的需要选择对应的版本,我用的是windows-x86-64版本的。

打开一个windows的版本你会看到如下几个文件:

如果要将nexus安装成windows服务,就点击install-nexus.bat这个文件,安装完成后,打开浏览器,访问http://localhost:8081/nexus/ 启动后如下页面,在右上角有个Log in 的超链接,点击登录

默认的用户名是 admin 密码是 admin123

登录后你可以在左侧修改登录信息:

接下来进入正题,仓库配置在左侧Repositories中

点击后会看到nexus提供的所有仓库类型,其中主要用的的就是3rd party、Snapshots、Releases这三个,分别作为第三方仓库,项目的快照仓库和项目的发布仓库.
这里以3rd party仓库为例,为大家演示如何上传jar包,方法很简单,选中3rd party仓库后选择Artifact
Upload标签,填好要上传包的groupID,ArtifactID,Version等信息后,点击下方upload按钮上传jar包即可。


上传之后可以在Browse Index中查看上传结果

完成了上传操作后,在我们本地构建过程中,打开Maven工程中的pom.xml文件,将repository标签中的信息配置为此远程私仓的信息,填好对应的dependency信息,即可完成本地构建从远程私仓中调用依赖的需求。

上面一系列眼花缭乱的操作看明白了么,如果没看明白接下来让我给你介绍个无比简单的解决方案—华为软件开发云 发布仓库!

发布服务提供的Maven仓库有release(发布仓),snapshot(快照仓),Mirror(中央仓镜像库),编译构建仓四种类型,其中release和snapshot属于租户级私有仓,用户归档用户内部软件组件的发布版本和快照版本,并支持通过Maven配置进行租户内依赖共享;Mirror仓主要代理并镜像缓存了grails-core、maven2、jcenter、grails-plugins四个中央仓的开源第三方组件,可作为租户内第三方私服仓库使用,提升依赖组件下载效率;编译构建仓是租户项目级私有仓,主要用于归档项目内构建出来的软件组件。

使用方法和远程私仓使用方法完全一样,但是省却大家所有自己搭建和维护远程私仓的工作和资源,即开即用,节省人力物力,提高开发效率。
你,心动了吗?赶快去华为软件开发云 网站注册账号并体验吧!