maven上传pom和jar文件到远程仓库

上传.pom文件

例如只想要上传 Spring Cloud Dependencies 的 .pom 文件到 Maven 远程仓库,可以执行如下命令

mvn deploy:deploy-file 
-Durl=repository-url 
-DrepositoryId=repository-id 
-Dfile=path-to-pom-file 
-DpomFile=path-to-pom-file

其中,需要替换以下参数:

  • repository-url: 远程仓库的 URL。
  • repository-id: 远程仓库的 ID,对应 Maven settings.xml 中的 <server> 配置。
  • path-to-pom-file: .pom 文件的路径。

如:

mvn deploy:deploy-file 
-Durl=http://example.com/repository/maven-releases 
-DrepositoryId=maven-releases 
-Dfile=/path/to/spring-cloud-dependencies.pom 
-DpomFile=/path/to/spring-cloud-dependencies.pom

上传jar

使用以下 Maven 命令将 Jar 包上传到远程仓库:

mvn deploy:deploy-file 
-Durl=repository-url 
-DrepositoryId=repository-id 
-Dfile=path-to-jar-file 
-DgroupId=your-groupId 
-DartifactId=your-artifactId 
-Dversion=your-version 
-Dpackaging=jar

需要替换以下参数:

  • repository-url: 远程仓库的 URL。
  • repository-id: 远程仓库的 ID,对应 Maven settings.xml 中的 <server> 配置。
  • path-to-jar-file: 要上传的 Jar 文件的路径。
  • your-groupId: Jar 文件的 Group ID。
  • your-artifactId: Jar 文件的 Artifact ID。
  • your-version: Jar 文件的版本号。

如:

mvn deploy:deploy-file 
-Durl=http://example.com/repository/maven-releases 
-DrepositoryId=maven-releases 
-Dfile=/path/to/your-artifact.jar 
-DgroupId=com.example 
-DartifactId=your-artifact 
-Dversion=1.0 
-Dpackaging=jar
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

JackHuan_code

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值