ubuntu系统上,用nexus搭建maven私服

来源:互联网 发布:我的世界linux版 编辑:程序博客网 时间:2024/05/21 09:45

ubuntu系统上,用nexus搭建maven私服




1.选择下载版本,地址https://www.sonatype.com/download-oss-sonatype


Nexus
提供了两种安装方式,内嵌Jetty的捆绑包(bundle)和WAR包。前者解压后即可单独运行,只要系统中安装了JRE,后者需要一个Servlet容器来运行.


2.解压开tar包,执行bin/nexus shell文件,如./nexusstart(启动)








3.修改端口 修改conf/nexus.properties文件,下的application-prot属性即可,然后重启nexus








浏览器打开地址如下:

http://localhost:8061/nexus/#welcome成功启动nexus






















4.点击右上角login默认的用户名和密码:admin/admin123登录











4.1点击central配置远程仓库























设置DownloadRemote Indexestrue,才会去远程仓库同步索引

再回到列表,右击点击repairindexupdateindex进行本地和远程同步

回到左边菜单,有个scheduledtasks可以查看正在执行的任务










































:这里比较容易失败,可以建立定时任务,定期去更新







5.上传本地jar到私服

选择相应版本,releases,在选项卡中选择artifactupload

GAVDefinition有两种上传方式

1.pom文件方式



2.自定义方式jar

设置Group组名,Artifactversion版本号,添加自定义jar,source包等,点击最下面的uploadartifact即可上传成功,在browseindex可以查看你当前上传的jar,或者搜索也可以查看到。































将这段xml放到mavenpom里即可下载







4.3还有一个组的概念

从右边把需要的仓库拉到左边即可

mavenconf/setting.xml,配置jar包下载这个组地址,即可下载,这个组里的所有仓库的jar










































<profile>

<id>dev</id>

<repositories>

<repository>

<id>public</id>

<name>publicrepository</name>

<url>http://192.168.19.91:8081/nexus/content/groups/public/</url>

<releases>

<enabled>true</enabled>

</releases>

<snapshots>

<enabled>true</enabled>

</snapshots>

</repository>

</repositories>

<pluginRepositories>

<pluginRepository>

<id>public</id>

<name>publicrepository</name>

<url>http://192.168.19.91:8081/nexus/content/groups/public/</url>

<releases>

<enabled>true</enabled>

</releases>

<snapshots>

<enabled>false</enabled>

</snapshots>

</pluginRepository>

</pluginRepositories>

</profile>





注,修改ip和端口

















Nexus的仓库分为这么几类:

  • hosted宿主仓库:主要用于部署无法从公共仓库获取的构件(如oracleJDBC驱动)以及自己或第三方的项目构件;

  • proxy代理仓库:代理公共的远程仓库;

  • virtual虚拟仓库:用于适配Maven1

  • group仓库组:Nexus通过仓库组的概念统一管理多个仓库,这样我们在项目中直接请求仓库组即可请求到仓库组管理的多个仓库。




PublicRepositories:仓库组

3rdparty:无法从公共仓库获得的第三方发布版本的构件仓库

ApacheSnapshots:用了代理ApacheMaven仓库快照版本的构件仓库

Central:用来代理maven中央仓库中发布版本构件的仓库

CentralM1 shadow:用于提供中央仓库中M1格式的发布版本的构件镜像仓库

CodehausSnapshots:用来代理CodehausMaven仓库的快照版本构件的仓库

Releases:用来部署管理内部的发布版本构件的宿主类型仓库

Snapshots:用来部署管理内部的快照版本构件的宿主类型仓库



0 0
原创粉丝点击