1. 程式人生 > >如何將jar包上傳到Maven中央倉庫

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

640?wxfrom=5&wx_lazy=1

來源 :csdn | 作者 : 孫琛斌|原文:閱讀原文

1.建立工單
1.1 https://issues.sonatype.org/secure/Dashboard.jspa新建一個賬號,登入後選擇Create Issue,
選擇Community Support - Open Source Project Repository Hosting (OSSRH)以及New Project,
其他按照你自己的專案情況填寫。 

640?wxfrom=5&wx_lazy=1

2.等待回覆
2.1 釋出完後幾小時內會有工作人員問你是否有Group Id對應的那個域名的所有權,如果有的話就回復有,
然後就會得到Configuration has been prepared的回覆,這個時候就可以準備釋出了。
如果自己沒有域名的話可以掛在開源的域名下面,例如com.gitee.sunchenbin,這樣一樣可以釋出。

2.2 下面是我的專案的幾次回覆,最終狀態變為Resolved的時候表示你有許可權可以上傳東西了。

640

3.使用gpg生成金鑰
 3.1我這裡使用的是windows,直接用的Git Gui的git-bash.exe如下
$ gpg 
gpg (GnuPG) 1.4.21; 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 IDfrom the Real Name, Comment and Email Address in this form:
   "Heinrich Heine (Der Dichter) <[email protected]uesseldorf.de>"Real name: sunchenbin
Email address: [email protected]163.com
Comment:
You selected this USER-ID:
   "sunchenbin <[email protected]>"Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit?
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 thedisks) during the prime generation; this gives the random numbergenerator a better chance to gain enough entropy.
......+++++
.....+++++
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 thedisks) during the prime generation; this gives the random numbergenerator a better chance to gain enough entropy.
........+++++
+++++
gpg: key 09D71290 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:   2  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 2u
pub   2048R/09D71290 2017-11-13
     Key fingerprint = 6A67 3904 E8BB F8D6 780B  CC5D 65E4 DAD5 09D7 1290uid                  sunchenbin <[email protected]163.com>
sub   2048R/23D05BFD 2017-11-13
這樣金鑰就產生了,You need a Passphrase to protect your secret key.
注意這裡輸入的密碼,後續上傳到maven中央倉庫是需要用到的。3.2 上傳金鑰首先檢視自己key的編號:
gpg --list-keys
4.配置pom.xml
4.1 pom中增加如下的配置就好   
<parent>
       <groupId>org.sonatype.oss</groupId>
       <artifactId>oss-parent</artifactId>
       <version>7</version>
   </parent>

   <name>com.gitee.sunchenbin.mybatis.actable:mybatis-enhance-actable</name>
   <description>A.CTable is a Maven project based on Spring and Mybatis, which enhances the function of Mybatis</description>
   <url>https://gitee.com/sunchenbin/mybatis-enhance</url>

   <licenses>
      <license>
         <name>The Apache Software License, Version 2.0</name>
         <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
         <distribution>actable</distribution>
      </license>
   </licenses>

   <developers>
       <developer>
           <name>sunchenbin</name>
           <email>[email protected]</email>
           <organization>sunchenbin</organization>
           <url>https://gitee.com/sunchenbin/mybatis-enhance</url>
       </developer>
   </developers>

   <scm>
       <connection>scm:git:[email protected]:sunchenbin/mybatis-enhance.git</connection>
       <developerConnection>scm:git:[email protected]:sunchenbin/mybatis-enhance.git</developerConnection>
       <url>https://gitee.com/sunchenbin/mybatis-enhance</url>
       <tag>1.0</tag>
   </scm>
   <distributionManagement>
       <snapshotRepository>
         
         <id>oss</id>
         <name>OSS Snapshots Repository</name>
         
         <url>https://oss.sonatype.org/content/repositories/snapshots/</url>  
       </snapshotRepository>
       <repository>
         <id>oss</id>
         <name>OSS Staging Repository</name>
         
         <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
       </repository>
     </distributionManagement>
4.2 配置Maven的settings.xml 
<servers>
 <server>
   <id>sonatype-nexus-snapshots</id>
   <username>上面第一步時註冊的帳號</username>
   <password>上面第一步時註冊的密碼</password>
 </server>
 <server>
   <id>sonatype-nexus-staging</id>
   <username>上面第一步時註冊的帳號</username>
   <password>上面第一步時註冊的密碼</password>
 </server>
</servers>
5.部署上傳jar包
命令列進入到專案pom.xml所在的目錄下,執行如下命令:
mvn clean deploy -P sonatype-oss-release -Darguments="gpg.passphrase=
過程中可能需要你手動輸入密碼。
6.release jar包
如果前幾個步驟全部正確完成,登入https://oss.sonatype.org/#stagingRepositories
(使用者名稱密碼就是第一步註冊時的使用者名稱密碼),將Staging Rpositories拉到最下即可看到你剛剛釋出的jar包,
選擇上方的Close,稍等片刻他先檢查一下你上傳的東西是否符合規範,檢查完畢後該條狀態被標記為closed,
此時選中後點上面的Release即可,等2個小時左右即可在http://search.maven.org/看到你釋出的jar包。
推薦閱讀

640

相關推薦

如何JAR釋出到Maven中央倉庫

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

如何jarMaven中央倉庫

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

本地jarmaven倉庫

本地jar包上傳遠端maven倉庫:cmd視窗執行下面一條命令 mvn deploy:deploy-file -DgroupId=com.xensource.xenapi -DartifactId=xenapi -Dversion=7.0 -Dpackaging=jar -Dfile=c:/use

用eclipse怎樣本地的專案打成jar到mevan倉庫

1、將maven 中的settings檔案配置好使用者名稱和密碼,如下: <servers> <server>       <id>releases</id>       <username>admin</u

Gradle5.x打jarmaven倉庫

releases 私有 get rep mave then pan 參考 release 1.上傳本地倉庫 1.1 build.gradle 項目設置 plugins { id ‘java‘ id ‘maven‘ //引入maven插件 }

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

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

jar到Hadoop伺服器並執行jar的方法--引數不對應導致報錯output directory already exists

 ERROR security.UserGroupInformation: PriviledgedActionException as:root cause:org.apache.hadoop.mapred.FileAlreadyExistsException:Outpu

如何 jar 導入Maven 本地倉庫

rac 例如 下載到本地 sta jdb 導入 pack dep maven 案例:oracle jar包由於在maven 遠程倉庫中找不到,需要先將oracle jar 文件下載到本地,然後導入maven本地倉庫,就可以通過 pom 進行依賴 例如:下載後的 jar 地

用eclipse怎樣本地的項目打成jarmaven倉庫

nag 需要 username ges blog rdp sso watermark fig 使用maven的項目中,有時需要把本地的項目打成jar包上傳到mevan倉庫。 操作如下: 1、將maven 中的settings文件配置好用戶名和密碼,如下: <ser

用eclipse怎樣本地的專案打成jarmaven倉庫

使用maven的專案中,有時需要把本地的專案打成jar包上傳到mevan倉庫。 操作如下: 1、將maven 中的settings檔案配置好使用者名稱和密碼,如下: <servers> <server>       <id>r

jar打包到本地和遠端maven倉庫

mvn install:install-file -Dfile=C:\Users\Administrator\Desktop\SH深圳航空\jar\szhk-sms-1.0.0.jar -DgroupId=com.szhk.sms -DartifactId=szhk-sms -Dversion=

nexus搭建maven私服及私服jar和下載

ive 校驗 public 我們 賬號 依賴 detail 接下來 triangle nexus搭建maven私服及私服jar包上傳和下載 標簽: nexus管理maven庫snapshot 2017-06-28 13:02 844人閱讀 評論(0) 收

Java 在Linux下使用nexus3搭建Maven私服並且使用Gradle進行jar以及依賴下載

今天我們來記錄一下如何通過Nexus3搭建Maven私服以及如何通過Gradle進行Jar包的上傳以及依賴使用 本人此次搭建教程使用的是Centos6.5,之前使用Centos7.3此安裝方法一樣適用,所以各版本的同學都可放心安裝。 1.Maven私服搭建 1.1

如何自己的jar釋出到mavan中央倉庫

最近自己寫了一個關於閘道器限流的外掛,然後想著肯定會有很多兄弟也需要使用到,所以就想著把jar包上傳到Maven的中央倉庫上讓大家可以更方便的使用 現在咱們來看一下這個流程是什麼樣的呢。 首先呢,你得去這個網站去註冊一個賬號https://issues.sonatyp

解決Maven本地倉庫沒有Jar問題,請求中央倉庫自動下載

一、首先修改maven的配置檔案settings.xml中的映象 配置國內的阿里雲映象,下載速度超級快,也不用擔心斷網的時候,jar只會下載一半。 二、當使用maven建立專案時,本地倉庫的沒有的jar包,如何讓中央倉庫自動下載: 步驟: 1.開啟maven資源的

本地的jar打到Maven倉庫

Java程式碼   mvn install:install-file   -DgroupId=包名   -DartifactId=專案名   -Dversion=版本號   -Dpackaging=jar   -Dfile=jar檔案所在路徑   以pinyi

mavenjar伺服器啟動程式

使用maven打jar包上傳伺服器執行程式步驟步驟1:在pom.xml中新增此段程式碼<build> <plugins> <plugin> <groupId>

maven學習-專案打成原始碼jar私庫

前言:打原始碼包,讓別人更容易看懂你寫的程式碼 1.在pom.xml中加入這句話 <build> <plugins> <!-- 要將原始碼放上去,需要加入這個外

nexus的jar與下載

fff eve ted min plugin 類型 localhost 第三方 服務 1. hosted,宿主倉庫,部署自己的jar到這個類型的倉庫,包括releases和snapshot兩部分,Releases公司內部發布版本倉庫、 Snapshots 公司內部測試版本

第三方安裝到maven本地倉庫

pid 本地倉庫 需要 jar TP pdf文檔 AR epo receive 今天在做jasper report生成pdf文檔的時候,需要引入亞洲字體jar包。maven倉庫是有這個jar包,但是在項目pom文件始終不能下載。無奈只有將jar包安裝到maven本地倉庫。