maven部署到私服

方法一:网页上传

1、账号登录 用户名/密码

2、地址 http://自己的ip:自己的端口/nexus

3、查看Repositories列表,选择Public Repositories,确定待上传jar包不在私服中

4、选择3rd party仓库,点击Artifact Upload页签

5、GAV Definition选择GAV Parameters

6、根据jar包路径填写Group、Artifact、Version等坐标信息

7、Packaging选择Jar

8、点击Select Artifact(s) to Upload按钮,选择待上传jar包,点击确认

9、若无多版本jar包,Classifier置空

10、点击Add Artifact按钮,将jar包加入上传列表

11、点击下方Upload Artifact(s)按钮,上传jar包

12、提示上传成功,即可根据坐标进行jar包依赖

方法二:maven deploy

settings.xml 文件配置密码

这里的id一定要和pom文件中的distributionManagement配置中的id保持一致

XML 复制代码
  <servers>
		 <server>  
			 <id>you-release</id>  		 
			 <username>admin</username>  	
			 <password>123456</password> 
		 </server>  
		 <server>  
			 <id>you-snapshot</id>  		 
			 <username>admin</username>  	
			 <password>123456</password> 
		 </server>
  </servers>

pom.xml配置

XML 复制代码
 <!-- 设置deploy的地址 -->
    <distributionManagement>
        <repository>
            <id>you-release</id>
            <name>acs release resp</name>
            <url>http://自己的ip:自己的端口/nexus/repository/maven-releases/</url>
        </repository>
 
        <snapshotRepository>
            <id>you-snapshot</id>
            <name>acs snapshot</name>
            <url>http://自己的ip:自己的端口/nexus/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

上传

方法三:命令上传

mvn deploy:deploy-file -DgroupId=xxxx -DartifactId=xxxxx -Dversion=xxxxx -Dpackaging=jar -Dfile=xxxx.jar -Durl=http://自己的ip:自己的端口/nexus/content/repositories/IACCOUNTING_Snapshot -DrepositoryId=deployAcct

snapshot版本和release版本区别

一般来说snapshots版本代表正在开发中的版本,release代表比较稳定的发布版本.

snapshots版本的-jar包后有时间戳不用管,maven会自动下载最新的

release版本没有时间戳

XML 复制代码
<groupId>com.example</groupId>
	<artifactId>demo</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>demo</name>
<description>Demo project</description>
XML 复制代码
<groupId>com.example</groupId>
	<artifactId>demo</artifactId>
	<version>1.0-RELEASE</version>
	<name>demo</name>
<description>Demo project</description>
相关推荐
她的男孩2 小时前
Spring Boot 接 Flowable 工作流:用 3 个注解搭一个请假审批流程
java·后端·架构
荣码4 小时前
LLM结构化输出:让AI返回JSON而不是废话,我踩了4个坑
java·python
plainGeekDev5 小时前
Gson → kotlinx.serialization
android·java·kotlin
小bo波14 小时前
Java Swing 图形用户界面实验 —— 从算术练习到游戏开发的完整实践
java·课程设计·gui·游戏开发·扫雷·swing
咖啡八杯15 小时前
GoF设计模式——备忘录模式
java·后端·spring·设计模式
SamDeepThinking1 天前
裁掉那个差程序员后,给你看团队里高手的代码:这个习惯,希望你有
java·后端·程序员
朕瞧着你甚好1 天前
技术雷达 & Java 集成评估报告 — Apache Tika 3.3.1
java·ai编程
MacroZheng1 天前
短短几天,暴涨2.8万Star!又一款编程神器开源!
java·人工智能·后端