转:建立maven私服
一、下载安装与配置
下载
到官网下载:https://www.sonatype.com/download-oss-sonatype
下载的是oss3.x版本的(当时最新版),
安装
1、先将下载后的zip文件解压到指定文件夹
2、直接双击exe文件会闪退,所以使用命令行,管理员方式运行cmd
安装:nexus.exe /install
卸载:nexus.exe /uninstall
启动:nexus.exe /start
停止:neuxs.exe /stop
3、(可做可不做)为了方便使用将bin弄成系统环境变量
4、安装并启动完成后 直接访问http://localhost:8081/(是默认端口) 默认用户:admin 密码:admin123
5、如果要修改端口,就修改配置文件中的 nexus-3.14.0-04\etc\nexus-default.properties 的 application-port
## DO NOT EDIT - CUSTOMIZATIONS BELONG IN $data-dir/etc/nexus.properties
##
# Jetty section
application-port=8081
application-host=0.0.0.0
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
nexus-context-path=/
# Nexus section
nexus-edition=nexus-pro-edition
nexus-features=\
nexus-pro-feature
配置用户
1、自改密码,进入用户账户,change password-->修改为其他密码就行了(1QsAZD0SV)
2、有其他问题直接上官网看文档
二、使用方式
上传jar包(三种方式)
1、如果是使用界面的update比较简单
2、使用配置方式 在maven的setting.xml文件中配置,要分清是自己下载的maven或者是idea的maven
<!-- 把jar包发布到私服中 -->
<!-- 配置服务器--><server>
<id>maven-public</id>
<username>admin</username>
<password>1QsAZD0SV</password> </server> <server>
<id>maven-releases</id>
<username>admin</username>
<password>1QsAZD0SV</password> </server> <server>
<id>maven-snapshots</id>
<username>admin</username>
<password>1QsAZD0SV</password> </server>
项目的pom文件
<distributionManagement>
<repository>
<id>maven-releases</id>
<name>Nexus Release Repository</name>
<url>http://localhost:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>maven-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://localhost:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
点击idea中deploy命令即可成功 mvn clean deploy 2.1.3 也可以使用命令行将下载的jar发布到私服
mvn deploy:deploy-file -DgroupId=com.weepal.wp-common
-DartifactId=wp-common -Dversion=1.3.0 -Dpackaging=jar
-DrepositoryId=nexus -Dfile=E:\Document\wp-common-1.3.0-RELEASE.jar-Durl=http://localhost:8081/repository/maven-release/
com.weepal.wp-common为pom中的groupId中的内容;
wp-common为pom中的artifactId中的内容;
1.3.0为pom中的version中的内容; 同时在maven中要添加权限
<server>
<id>nexus</id>
<username>admin</username>
<password>1QsAZD0SV</password>
</server>
<repository>
<id>nexus</id>
<url>http://localhost:8081/repository/maven-release/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
从私服下载jar包
1、在pom文件中配置
<!-- 假如没有私服 ,则 本地仓库找不到,则访问中心仓库
假如有私服 :访问顺序
首先访问本地仓库
本地仓库没有,则访问私服仓库
私服仓库也没有,则访问中心仓库
-->
<!--下载jar配置开始-->
<repositories>
<repository>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>nexus</id>
<name>Nexus Repository</name>
<url>http://localhoot:8081/repository/maven-public/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<name>Nexus Plugin Repository</name>
<url>http://localhoot:8081/repository/maven-public/</url>
</pluginRepository>
</pluginRepositories>
<!--下载jar包配置结束-->
作者:nayli
链接:https://www.jianshu.com/p/93fac0ac2202
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
最新文章
- JAVA编程思想(第四版)学习笔记----4.8 switch(知识点已更新)
- 分析错误:socket accept failed too many open files
- mysql 大小写问题-sql-mode问题
- Intellij修改archetype Plugin配置
- finetuning caffe
- Idea_Intellij Idea 12 生成serialVersionUID的方法
- 使用本地JConsole监控远程JVM (转)
- java操作xm——添加、修改、删除、遍历
- mac安装软件运行提示「xxx.app已损坏,打不开.你应该将它移到废纸篓」的解决办法
- ajax第三步
- Linux系列教程(五)——Linux链接命令和权限管理命令
- C++几个技巧:智能指针在消息传递中的使用,元组,及lambda删除器
- 反射 XML和JSON
- table中border-collapse的问题
- BindingFlags 枚举
- ueditor 上传图片
- 【spring cloud】服务启动后正常,但是无法上线,一直处于down状态
- Java - ";JUC"; ReentrantReadWriteLock
- 一个JS引发的血案
- IntelliJ IDEA 2017版 导入项目项目名称为红色
热门文章
- JS高级---函数作为参数使用
- js bug
- 在一个formitem中多input的验证方法-antd的验证
- 题解【CJOJ1071/UVA】硬币问题
- AC3 mantissa quantization and decoding
- form表单提交且接口回调显示提交成功
- JS-ES6语法运用
- kuangbin专题 专题九 连通图 Critical Links UVA - 796
- 协同ADMM求解考虑碳排放约束直流潮流问题的对偶问题(A Distributed Dual Consensus ADMM Based on Partition for DC-DOPF with Carbon Emission Trading)
- 【译】PHP 内核 — zval 基础结构