maven上传artifact

目前使用的 nexus 3 暂未提供 UI 上传 artifact 功能,推荐使用 mvn deploy maven deploy-file 参考) 进行上传。

完整项目:

mvn deploy


非完整项目(零散的jar):

mvn deploy:deploy-file

例子:

mvn deploy:deploy-file -DgroupId=com.xxx.hub -DartifactId=hub-api -Dversion=1.0 -Dpackaging=jar -Dfile=/Desktop/hub-api-1.0.jar -DpomFile=/Desktop/hub-api-1.0.pom -Durl=http://nexus.xxx:8081/repository/maven-thirdparty/ -DrepositoryId=releases

其中:

-DgroupId=com.xxx.hub -DartifactId=hub-api -Dversion=1.0 -Dpackaging=jar 指定将上传的 artifact 信息;

-Dfile=/Desktop/hub-api-1.0.jar -DpomFile=/Desktop/hub-api-1.0.pom 指定将上传的 artifact 文件;(pomFile 可选,请尽量上传)

-Durl=http://nexus.xxx:8081/repository/maven-thirdparty/ 指定上传到哪里(上传maven第三方请勿修改);

-DrepositoryId=releases 指定repositoryId,将与 maven 配置文件[如 settings.xml]中匹配(只要能匹配上,名字随意)。

 

<servers>
<server>
<id>releases</id>
<username>账号</username>
<password>密码</password>
</server>
</servers>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
上传jar包到 Maven 仓库需要执行以下步骤: 1. 在本地 Maven 仓库中安装 jar 包 在命令行中执行以下命令: ``` mvn install:install-file -Dfile=path/to/your.jar -DgroupId=your.group.id -DartifactId=your-artifact-id -Dversion=your-version -Dpackaging=jar ``` 其中,`path/to/your.jar` 是你要上传的 jar 包路径,`your.group.id` 、`your-artifact-id` 和 `your-version` 分别代表你的 Maven 项目的 Group ID、Artifact ID 和版本号。 2. 配置 Maven 项目的 pom.xml 文件 在 Maven 项目的 `pom.xml` 文件中添加以下配置: ``` <repositories> <repository> <id>your-repo-id</id> <url>https://your.repo.url</url> </repository> </repositories> <dependencies> <dependency> <groupId>your.group.id</groupId> <artifactId>your-artifact-id</artifactId> <version>your-version</version> </dependency> </dependencies> <distributionManagement> <repository> <id>your-repo-id</id> <url>https://your.repo.url</url> </repository> </distributionManagement> ``` 其中,`your-repo-id` 和 `https://your.repo.url` 分别代表你的 Maven 仓库的 ID 和 URL。 3. 配置 Maven 的 settings.xml 文件 在 Maven 的 `settings.xml` 文件中添加以下配置: ``` <servers> <server> <id>your-repo-id</id> <username>your-username</username> <password>your-password</password> </server> </servers> ``` 其中,`your-username` 和 `your-password` 分别代表你的 Maven 仓库的用户名和密码。 4. 执行 Maven 的 deploy 命令 在命令行中执行以下命令: ``` mvn deploy ``` 这将会把你的 jar 包上传Maven 仓库中。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值