1. 程式人生 > >釋出Jar包到Maven中央倉庫

釋出Jar包到Maven中央倉庫

建立工單

  1. https://issues.sonatype.org/secure/Dashboard.jspa新建一個賬號,登入後選擇Create Issue,選擇Community Support - Open Source Project Repository Hosting (OSSRH)以及New Project,其他按照你自己的專案情況填寫。
    這裡寫圖片描述
  2. 釋出完後幾小時內會有工作人員問你是否有Group Id對應的那個域名的所有權,如果有的話就回復有(我一開始以為這是系統自動回覆,沒有管它,結果好幾天過後還是沒再回復過我…),然後就會得到Configuration has been prepared的回覆,這個時候就可以準備釋出了。如果自己沒有域名的話可以掛在開源的域名下面,例如com.github.flyzy2005,這樣一樣可以釋出。

生成金鑰

  1. 我用的是windows,直接去https://www.gpg4win.org/download.html下載Gpg4win,安裝好後通過gpg --version,出現版本等資訊就安裝成功了。(如果是Linux,可以通過yum install gpg安裝)
    這裡寫圖片描述
  2. 設定名字+郵箱,其他可以使用預設值,記住輸入的passphrase,後面部署會用到,這裡用參考文章裡的配圖:
$ gpg --gen-key
gpg (GnuPG) 1.4.19; Copyright (C) 2015 Free Software Foundation, Inc.
This is free software: you are free to
change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Please select what kind of key you want: (1) RSA and RSA (default) (2) DSA and Elgamal (3) DSA (sign only) (4) RSA (sign only) Your selection? RSA keys may be between 1024 and 4096 bits long. What keysize do
you want? (2048) Requested keysize is 2048 bits Please specify how long the key should be valid. 0 = key does not expire <n> = key expires in n days <n>w = key expires in n weeks <n>m = key expires in n months <n>y = key expires in n years Key is valid for? (0) Key does not expire at all Is this correct? (y/N) Y You need a user ID to identify your key; the software constructs the user ID from the Real Name, Comment and Email Address in this form: "Heinrich Heine (Der Dichter) <[email protected]>" Real name: iteblog Email address: wyphao.2007@163.com Comment: flink-elasticsearch-connector You selected this USER-ID: "iteblog (flink-elasticsearch-connector) <[email protected]>" Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O You need a Passphrase to protect your secret key. We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy. +++++ .+++++ gpg: /c/Users/iteblog/.gnupg/trustdb.gpg: trustdb created gpg: key B15C5AA3 marked as ultimately trusted public and secret key created and signed. gpg: checking the trustdb gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u pub 2048R/B15C5AA3 2016-09-19 Key fingerprint = DB61 9873 924C 020E 20E7 E461 0170 C912 B15C 5AA3 uid iteblog (flink-elasticsearch-connector) <wyphao.2007@163.com> sub 2048R/31A906E1 2016-09-19

配置pom.xml

  1. 配置專案pom.xml
    主要需要配置parent結點,以及增加license、scm、developers資訊,這裡講我自己的pom.xml作為一個參考:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>cn.flyzy2005</groupId>
  <artifactId>daoutil</artifactId>
  <packaging>jar</packaging>
  <name>daoutil</name>
  <url>http://www.flyzy2005.cn</url>
  <description>A daoUtil based on JdbcTemplate.</description>

  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
  </parent>
  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <scm>
    <url>https://github.com/Flyzy2005/daoutil</url>
    <connection>[email protected]:Flyzy2005/daoutil.git</connection>
    <developerConnection>http://www.flyzy2005.cn</developerConnection>
  </scm>
  <developers>
    <developer>
      <name>fly</name>
      <email>[email protected]</email>
      <url>http://www.flyzy2005.cn</url>
    </developer>
  </developers>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <springversion>4.3.3.RELEASE</springversion>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <version>${springversion}</version>
    </dependency>

    <dependency>
      <groupId>com.alibaba</groupId>
      <artifactId>fastjson</artifactId>
      <version>1.2.31</version>
    </dependency>
  </dependencies>
</project>
  1. 配置Maven的settings.xml
    安裝配置好maven後,在maven的安裝目錄下的conf資料夾下找到settings.xml,設定如下:
<servers>
  <server>
    <id>sonatype-nexus-snapshots</id>
    <username>Sonatype網站的賬號</username>
    <password>Sonatype網站的密碼</password>
  </server>
  <server>
    <id>sonatype-nexus-staging</id>
    <username>Sonatype網站的賬號</username>
    <password>Sonatype網站的密碼</password>
  </server>
</servers>

賬號密碼就是第一步申請的Sonatype網站的賬號密碼。

部署Jar包

通過cmd進入到專案pom.xml所在的目錄下,執行如下命令:

mvn clean deploy -P sonatype-oss-release -Darguments="gpg.passphrase=設定gpg設定金鑰時候輸入的Passphrase"

如果沒有ERROR的話就deploy完成了,如果有ERROR就看錯誤資訊是什麼,解決了重新執行命令即可,執行完成的所有檔案存在專案目錄下的target資料夾裡。

上傳金鑰

兩句命令即可,首先檢視自己key的編號:

gpg --list-keys

找到 pub對應的那個編號,例如pub 2048R/8C473F5C
上傳到key驗證庫:

gpg --keyserver hkp://keyserver.ubuntu.com:11371 --send-keys 8C473F5C

release jar包

如果前幾個步驟全部正確完成,登入https://oss.sonatype.org/#stagingRepositories後,將Staging Rpositories拉到最下即可看到你剛剛釋出的jar包,選擇上方的Close,第一次好像會有工作人員回覆你第一步Create的那個Issue(我的是回覆了)Everything looks good! Now, all that’s left for you is to select that staging repository and click the “Release” button.,然後再點選Release即可,等2個小時左右即可在http://search.maven.org/看到你釋出的jar包。

更新Jar包

只需要更新pom.xml裡的version,再重新depoly,重新close,再release即可。(如果version沒有改變則會覆蓋掉中央倉庫的當前版本)。

參考

相關推薦

釋出jarmaven中央倉庫 ,上傳maven

一、註冊賬號 通過上面地方註冊賬號 二、提交工單 登入成功後,會顯示此介面。選擇建立 填寫基本資訊:group id一定要寫正確,真實存在,因為這個我就提交了兩次 儲存等他們客服回覆。 三、收到郵件後,是否通過,不通過根據情況修改。 收到

釋出自己的jarmaven中央倉庫

  參考我自己的例項 https://issues.sonatype.org/browse/OSSRH-36402 官方指引 https://central.sonatype.org/pages/ossrh-guide.html 下面是官方指引的內容 OS

上傳自己的構件(Jar)到Maven中央倉庫

https://blog.csdn.net/persistencegoing/article/details/84376427   背景:               

記一次上傳jarmaven中央倉庫記錄

最近利用工作閒暇之餘,開發了一個基於logback底層的日誌脫敏工具jar 包(歡迎大家吐槽:logback日誌脫敏工具),同事推薦上傳到maven中央倉庫,方便大家使用。於是萌生了上傳jar 包到maven中央倉庫的想法,在此分享一下將jar包釋出到Maven中央倉庫的

提交本地jarMaven中央倉庫(Windows)的那些小事

參考部落格: 建立賬戶就不說了。可以參考1部落格檢視相關截圖步驟哦。別用中文註冊即可 建立一個Issue Group Id一定要和專案pom裡面配置的一樣哦。2個URL填寫專案所在地址即可。鄙人用的碼雲。 等待Issue官方人員稽核 成功後狀態如圖: 小小插曲

釋出專案到maven中央倉庫

可能很多人都在用maven倉庫,但是如果要問怎麼釋出專案到中央倉庫,估計很多人都不知道了,下面本篇文章帶大家往中央倉庫釋出一個自己的maven專案。 往maven中央倉庫釋出元件的過程是與Sonatype工作人員互動的過程,這個過程是在Sonatype的JIRA平臺上完成

Gradle 釋出 JAR maven 中央倉庫(sonatype )

釋出包到 maven 倉庫 本文不與 https://zq99299.github.io/note-book/gradle/push-to-maven.html 同步更新 關於本文一些跳轉 404 問題,不知道 csdn 怎麼進行頁內跳轉;覺得閱讀不方便可檢視上面的地址

如何將JAR釋出Maven中央倉庫

將jar包釋出到Maven中央倉庫(Maven Central Repository),這樣所有的Java開發者都可以使用Maven直接匯入依賴,例如fundebug-java: <!-- https://mvnrepository.com/artifact/com.fundebug/fundebug

釋出JarMaven中央倉庫

建立工單 去https://issues.sonatype.org/secure/Dashboard.jspa新建一個賬號,登入後選擇Create Issue,選擇Community Support - Open Source Project Reposit

centos7 搭建nexus 倉庫配置和maven釋出jar倉庫

一、搭建nexus 倉庫 ## 建立/usr/local/nexus 目錄 $ mkdir /usr/local/nexus ; /cd /usr/local/nexus ## 下載nexus 安裝包 $ wget https://sonatype-download.global.

Maven中央倉庫提交JAR

本文將詳細介紹所有向Maven中央倉庫提交SDK(對於JAVA即是jar包)的流程。如果您已經完成了整個流程但遇到一些問題,可以直接跳到文末,那裡總結了很多遇到的問題以及解決的方案。 1. sonatype工單 為了向Maven中央倉庫提交SDK,我們首先要向sonatype系統提交工單

Jar釋出MAVEN中央倉庫實踐

1)如果使用的是Windows,可以到https://www.gpg4win.org/download.html下載gpg4win,推薦使用 Gpg4win-Vanilla 2.3.3版本 2)如果使用的是Linux,可以通過yum install gpg命令安裝gpg。 linux下: gpg --gen

手動在本機倉庫中放置jar以解決Maven中央倉庫不存在該資源的問題

  Maven大大簡化了專案中對外部資源的依賴操作,節約了開發人員大量時間。不過不是每個依賴的資源都會放在Maven中央倉庫,比如當前用到的友盟統計資料SDK我就沒在網上找到。只好手動新增jar包到了專案中,執行沒問題,打包時卻報了一些xx找不到的問題。   那就自己在maven本機倉庫中加下吧,pom檔案

釋出JarMaven中心倉庫

目錄: 1. 準備 注意:group id需要證明自己擁有這個域名,通過傳送郵件的方式。 第二天,通過人工稽核之後,status的狀態就變成了 RESOLVED,至此,我們完成了釋出前的準備工作。 2. 配置mave

如何將jar上傳到Maven中央倉庫

來源 :csdn | 作者 : 孫琛斌|原文:閱讀原文1.建立工單1.1 https://iss

配置maven環境變量並安裝jar到本地倉庫

mave checksum 查看 img 下載 mage net 解壓 nbsp 1.下載maven安裝包,解壓,解壓目錄如下: 2.配置M2_HOME變量為上一步的路徑: 3.配置PATH變量,添加%M2_HOME%\bin; 查看是否配置成功 mvn -v :

maven手動導入jar到本地倉庫

jar包 maven color art style maven安裝 操作 packaging 路徑 1、使用cmd進入maven安裝目錄下的bin 2、運行mvn install:install-file -Dfile=jar包的路徑 -DgroupId=gruopId

maven安裝第三方jar到本地倉庫

color packaging 需要 pid 生成 art 倉庫 span jar下載   添加項目依賴的時候,有些jar下載不下來,只有手動下載或安裝到本地倉庫了 首先下載所需要的jar,放到指定的文件夾 然後執行如下命令: mvn install:in

maven中手動將jar安裝進倉庫的方法及問題

maven 眾所周知,我們只要在pom.xml文件中進行配置,maven就會自動下載jar包到本地倉庫,那麽,如果我們自己寫一個jar包自己用,那麽便無法通過配置來引用這個包,需要我們手動將包安裝進倉庫中。 我們使用命令mvn install:install-file -Dfile=your-j

Maven 手動添加 JAR 到本地倉庫

還可以吧 -c pub 1.0 兩個 很多 eight -s 安裝到本地倉庫 Maven 確確實實是個好東西,用來管理項目顯得很方便,但是如果是通過 Maven 來遠程下載 JAR 包的話,我宿舍的帶寬是4兆的,4個人共用,有時候用 Maven 來遠程下載 JAR 包會顯得