Linux 使用nexus搭建maven私服
一、搭建
1.下载nexus
https://www.sonatype.com/download-oss-sonatype
2.上传到/root
3.解压
tar -zxvf nexus-3.12.1-01-unix.tar.gz -C /usr/local/
4.修改配置文件
♦端口
vim /usr/local/nexus-3.12.1-01/etc/nexus-default.properties
♦防火墙
vim /etc/sysconfig/iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT
5.登陆浏览器打开
http://192.168.56.102:8081/ 账号admin 密码 admin123 System Requirement: max file descriptors [4096] likely too low, increase to at least [65536].
6.修改ulimit
vim /etc/security/limits.conf 新增 * soft nofile 65535 * hard nofile 65535
7.设置开机自启动
二、使用
1.仓库类型
proxy:代理仓库,用于代理远程仓库 group:仓库组,通常包含了多个代理仓库和宿主仓库,在项目中只要引入仓库组就可以下载到代理仓库和宿主仓库中的包 hosted:宿主仓库,内部项目、付费jar releases 发布内部release版本的仓库 snapshots 发布内部snapshots版本的仓库 third 自建第三方jar
2.配置代理
选择阿里云http://maven.aliyun.com/nexus/content/groups/public/
3.本地maven配置
<?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">
<pluginGroups>
</pluginGroups>
<proxies>
</proxies>
<servers>
<!-- id需要跟pom.xml的一样-->
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
</servers>
<mirrors>
<mirror>
<id>repo1</id>
<mirrorOf>*</mirrorOf>
<name>Human Readable Name</name>
<url>http://39.98.204.96:8081/repository/bjaxyh/</url>
</mirror>
<mirror>
<id>osc</id>
<mirrorOf>central</mirrorOf>
<url>http://maven.aliyun.com/nexus/content/repositories/central</url>
</mirror>
<mirror>
<id>osc_thirdparty</id>
<mirrorOf>thirdparty</mirrorOf>
<url>http://maven.aliyun.com/nexus/content/repositories/central</url>
</mirror>
</mirrors>
<profiles>
<profile>
<!-- 私有库地址-->
<repositories>
<repository>
<id>nexus</id> <!-- 私有仓库唯一标识-->
<name>local private nexus</name><!--私有库名称 -->
<!--私有库地址-->
<url>http://39.98.204.96:8081/repository/bjaxyh/</url>
<releases>
<enabled>true</enabled><!--是否下载releases版本构件-->
</releases>
<snapshots>
<enabled>false</enabled><!--是否下载snapshots版本构件-->
</snapshots>
</repository>
</repositories>
<!--插件库地址-->
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>local private nexus</name>
<url>http://39.98.204.96:8081/repository/bjaxyh/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>osc</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>osc</id>
<url>http://maven.aliyun.com/nexus/content/repositories/central</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>osc</id>
<url>http://maven.aliyun.com/nexus/content/repositories/central</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
4.修改pom
<!--pom.xml 远程仓库的配置 id要跟本地maven的setting.xml相同 -->
<distributionManagement>
<repository>
<id>releases</id>
<name>Ruizhi Release Repository</name>
<url>http://192.168.56.101:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Ruizhi Snapshot Repository</name>
<url>http://192.168.56.101:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
5.测试是否nexus搭建成功
pom添加本地没有的依赖,看nexus会不会代理
mvn deploy 看是否成功推送至nexus
三、nexus图片观赏





四、pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>axyh_springboot</groupId>
<artifactId>axyh_springboot</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>com.anxinyiheng</groupId>
<artifactId>axyh_parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
</dependencies>
<distributionManagement>
<repository>
<!--此id要与setting.xml里面server的id对应-->
<id>releases</id>
<name>releases Repository</name>
<url>http://39.98.204.96:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>snapshots</name>
<url>http://39.98.204.96:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中 -->
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Linux 使用nexus搭建maven私服的更多相关文章
- Linux使用nexus搭建maven私服
一.准备工作 系统:LINUX JDK:已安装(未安装详见jdk安装教程:http://www.cnblogs.com/muzi1994/p/5818099.html) ...
- Maven-004-使用 Nexus 搭建 maven 私服
从去年至今,自己一直在学习自动化测试工具,想利用自动化工具尽可能的将重复的.关键的.耗时耗力的工作实现自动化,减轻日常测试工作,提升测试效率.在学习的过程中,将 maven 作为了项目开发管理工具,进 ...
- Maven使用笔记(五)Sonatype Nexus 搭建Maven 私服
1. 为什么使用Nexus 如果没有私服,我们所需的所有构件都需要通过maven的中央仓库和第三方的Maven仓库下载到本地, 而一个团队中的所有人都重复的从maven仓库下载构件无疑加大了仓库的负载 ...
- Maven——使用Nexus搭建Maven私服
原文:http://www.cnblogs.com/xdp-gacl/p/4068967.html Maven学习总结(九)--使用Nexus搭建Maven私服 一.搭建nexus私服的目的 为什么要 ...
- (转)Maven学习总结(九)——使用Nexus搭建Maven私服
孤傲苍狼只为成功找方法,不为失败找借口! Maven学习总结(九)——使用Nexus搭建Maven私服 一.搭建nexus私服的目的 为什么要搭建nexus私服,原因很简单,有些公司都不提供外网给项目 ...
- Maven学习二:使用Nexus搭建Maven私服及相关配置
处于安全等原因的考虑,一些企业内部网络是不允许访问外部网络的,但是项目内部搭建的项目又是Maven架构,这样就需要企业在内部网络中搭建自己的Maven仓库服务,再者一些大型企业或者内部模块化组件化划分 ...
- 使用Nexus搭建Maven私服问题总结
#业务场景 最近项目要交付给客户了,之前项目开发和测试一直都是使用公司内部的一套环境,项目交付后客户购置了大量服务器,也要将整套测试环境迁移至客户的服务器上,后续的需求变更以及新需求的开发都会在客户服 ...
- nexus搭建maven私服及私服jar包上传和下载
nexus搭建maven私服及私服jar包上传和下载 标签: nexus管理maven库snapshot 2017-06-28 13:02 844人阅读 评论(0) 收藏 举报 分类: Maven(1 ...
- nexus 搭建 maven 私服
nexus 搭建 maven 私服 本机环境 Win 8 JDK 7 Maven 3.2 Nexus 2.11 版本选择 http://www.sonatype.org/nexus/archivedn ...
随机推荐
- PHP全路径无限分类导航LINK代码实现
<?php /** * @param php全路径无限分类 */ include('db.inc.php'); function getPathCate($cateid){ $sql = &qu ...
- thinkphp——通过在线编辑器添加的内容在模板里正确显示(只显示内容,而不是html代码)
thinkphp编辑器回显问题如下: 解决办法如下: 对于编辑器发布的内容,前台模板显示为html的解决办法是: 在模板输出字段加入html_entity_decode()函数 也就是:PHP输出时的 ...
- 微信小程序-查询快递
1.新建快速启动项目 2.在设置里面勾选不校验合法域名,以防编译报错 3.在app.json中改一下窗口表现:app.json—"navigationBarTitleText": ...
- JS之汉字与Unicode码的相互转化
有时候,我们在给后端传递变量的的值中有汉字,可能由于编码的原因,传递到后端后变为乱码了.所以有时候为了省事或者其它特殊要求的时候,会把传递的汉字转换成Unicode编码后再进行传递. 当然汉字转换成u ...
- 2 >&1 的准确含义
1. 2代表标准错误,2 > 表示重定向,就是把标准错误重定向到 1中,这个1如果想表示标准输出的话,就必须在前面加 & 2. 正常情况下,下面这个会有很多错误信息,但是加上2>& ...
- Android为TV端助力 关于android的一些基础知识
怕自己以后忘了,所以在这里先写写! equal和==的区别是,一个用于判断字符串,一个用于判断int是否相等 equal比较的是对象,==比较的是值
- Android--小游戏
GitHub:https://github.com/vinieo/game 功能描述 “猜小球”是一个简单的愉悦身心的小游戏,它的功能结构如图a-1所示. 构建开发环境 在开发本游戏时,首先需要下 ...
- python语言学习---3
第四天 1.set 持有一系列元素,这一点和 list 很像,但是set的元素没有重复,而且是无序的, 这点和 dict 的 key很像. (不信可以输出下试试 ~-~ )另外,其存储的对象必须不可变 ...
- git 入门教程之 git 私服搭建教程
git 私服搭建教程 前几节我们的远程仓库使用的是 github 网站,托管项目大多是公开的,如果不想让任何人都能看到就需要收费,而且 github 网站毕竟在国外,访问速度太慢,基于上述两点原因,我 ...
- [katalon] 页面切换
UI自动化测试过程中会涉及到需要切换多个页面, 如点击一个按钮之后跳转到新的页面, 后者A站点提交信息后,B站点审核. Katalon虽然不支持控制多个浏览器,但是支持处理tab切换. 核心方法是使用 ...