zl程序教程

您现在的位置是:首页 >  后端

当前栏目

将 3rd 方 JAR 部署到远程 Maven 库

2023-06-13 09:15:27 时间

1. 安装 Maven

下载地址

2. settings.xml 配置

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <pluginGroups></pluginGroups>

  <proxies></proxies>

  <servers>
    <server>
        <id>xxx_release</id>
        <username>Android</username>
        <password>xxx</password>
    </server>
    <server>
        <id>xxx_snapshot</id>
        <username>Android</username>
        <password>xxx</password>
    </server>
  </servers>

  <distributionManagement>
        <repository>
            <id>xxx_release</id> <!--四个id 要保持一致-->
           <url>https://nexus.xxx.city/repository/releases/</url>
        </repository>
        <snapshotRepository>
            <id>xxx_snapshot</id>
            <url>https://nexus.xxx.city/repository/snapshots/</url>
        </snapshotRepository>
  </distributionManagement>

  <mirrors></mirrors>

  <profiles></profiles>
</settings>

3. 执行传包命令

官方文档

mvn deploy:deploy-file 
-Dmaven.test.skip=true
-Dfile=/Users/cui/Downloads/hub-client-all-2022.2.14835.jar
-Dpackaging=jar 
-DgroupId=com.intellij.hub
-DartifactId=hub-client-all
-Dversion=2022.2.14835 
-DrepositoryId=xxx_release 
-Durl=https://nexus.xxx.city/repository/releases/