nexus私服linux搭建
来源:互联网 发布:mac 手绘动画 编辑:程序博客网 时间:2024/06/10 07:58
下载nexus包,点击下载,放入Linux中
vim etc/profile 在该文件最下方 加入:
export RUN_AS_USER=root
进入该nexus的包bin目录 ./nexus start 启动服务
在地址栏里输入服务IP地址和8081端口就可以打开用户界面,例如http://192.168.46.144:8081/nexus
注:记得关闭防火墙 service iptables stop
如果不能打开:
1.查看logs目录下的wrapper.log日志,出现以下错误
Prefix file size exceeds maximum allowed size (100000)
找到conf目录下nexus.properties 文件,这个文件在conf里面,我用的centos其他的系统去找找吧, 添加这:
org.sonatype.nexus.proxy.maven.routing.Config.prefixFileMaxSize = 500000
如下图:
点Sign In登录管理页面,用户名密码为,admin和admin123
在Repositories页面里显示着,默认已经创建了5个仓库(2个为group),直接可以拿来用,无需再自行创建仓库。
如果需要配置域名为http://lixy.com:8081/nexus
1.修改nexus.properties文件的application-host=lixy.com
2.在linux的/etc/hosts文件下增加 192.168.46.144 lixy.com
3.在window的hosts中增加192.168.46.144 lixy.com
使用方法
搭建Maven私有仓库的主要目的,是为了在团队多人开发时,只要内网的私有仓库有下载过依赖的jar包,就直接从私有仓库获取,不再通过外网的中央仓库,毕竟外网的下载速度实在是太慢了。
在项目的pom.xml或者settings.xml文件里加入一下配置信息(区别,pom.xml是针对当前项目,settings.xml是全局的针对所有项目)
配置信息中的id,name和url跟上图中的仓库对应
.m2中的settings.xml
<localRepository>F:\repository</localRepository>
<servers>
<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
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
-->
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://192.168.46.144:8081/nexus/content/groups/public/</url>
</mirror>
</mirrors>
如果配置了域名lixy.com,则http://192.168.46.144:8081/nexus/content/groups/public/可以修改为
http://lixy.com:8081/nexus/content/groups/public/
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>lixy.maven</groupId> <artifactId>nexus-test</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>nexus-test</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <!-- https://mvnrepository.com/artifact/junit/junit --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.35</version> </dependency> </dependencies> <distributionManagement> <repository> <id>releases</id> <name>releases</name> <url>http://192.168.46.144:8081/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>snapshots</id> <name>snapshots</name> <url>http://192.168.46.144:8081/nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>true</skip> </configuration> </plugin> <!--source--> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.2.1</version> <configuration> <attach>true</attach> </configuration> <executions> <execution> <phase>compile</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <!--spring boot 使用打包--> <!--<build> <finalName>profit-card-app-backend</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>--></project>
如果配置了域名lixy.com,则可以将
http://192.168.46.144:8081/nexus/content/repositories/snapshots/
修改为http://lixy.com:8081/nexus/content/repositories/snapshots/
详情参考自己的百度云
- Linux 搭建nexus私服
- Linux 搭建 nexus 私服
- linux搭建nexus私服
- nexus私服linux搭建
- nexus私服linux搭建问题
- nexus私服linux搭建问题
- Linux 搭建 maven+Nexus私服
- linux环境搭建nexus私服
- linux 环境搭建 nexus 私服
- Nexus 私服(Linux)搭建
- Linux搭建Maven开发常用nexus私服
- Linux下使用nexus搭建maven私服
- Linux下使用nexus搭建maven私服
- Linux下使用nexus搭建maven私服
- Linux下使用nexus搭建maven私服
- Linux 使用nexus搭建maven私服
- Linux Centos7 nexus搭建maven私服
- Linux下使用Nexus搭建Maven私服
- c语言第一次练习题
- 【Jave】Java解析html页面的元素Element——获取下拉框中的值和文本selected-option
- 如何看待和学习基础servlet???
- c语言小练习
- css部分常用功能
- nexus私服linux搭建
- 一种说不出的“Feeling”
- Pytorch入门教程(一)基础
- hibernate初步认识
- Python入门(二)
- echart 画 二维图的解析规范
- 关于vim的不可不知的快捷键
- 十月十四日课堂笔记
- png图片半透明部分在网页中显示为白色的处理