maven仓库jar包发布指南

install gpg

brew install gnupg

check

➜  ~ gpg --version
gpg (GnuPG) 1.4.20
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg
支持的算法:
公钥:RSA, RSA-E, RSA-S, ELG-E, DSA
对称加密:IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256,
               TWOFISH, CAMELLIA128, CAMELLIA192, CAMELLIA256
散列:MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
压缩:不压缩, ZIP, ZLIB, BZIP2

生成密钥对

gpg --gen-key

查看公钥

gpg --list-keys

将公钥发布到 PGP 密钥服务器

gpg --keyserver hkp://pool.sks-keyservers.net --send-keys xxxxxxxx

其中xxxxxxxx为你的公钥id

查看是否发布成功

gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys xxxxxxxx

配置maven

~/.m2/settings.xml


    
        
            oss
            用户名
            密码
        
    

配置项目pom.xml


        Github Issue
        https://github.com/xxx/xxx-xxx/issues
    

    
        
            The Apache Software License, Version 2.0
            http://www.apache.org/licenses/LICENSE-2.0.txt
        
    

    
        
            xxx
            [email protected]
        
    

    
        scm:[email protected]:xxx/xxx-xxx.git
        scm:[email protected]:xxx/xxx-xxx.git
        [email protected]:xxx/xxx-xxx.git
    

    
        
            
                org.apache.maven.plugins
                maven-compiler-plugin
                
                    ${java.version}
                    ${java.version}
                
            
            
                org.springframework.boot
                spring-boot-maven-plugin
                
                    true
                
            

            
                org.apache.maven.plugins
                maven-javadoc-plugin
                2.10.4
                
                    true
                
            
        
    

    
        
            release
            
                
                    oss
                    https://oss.sonatype.org/content/repositories/snapshots/
                
                
                    oss
                    https://oss.sonatype.org/service/local/staging/deploy/maven2/
                
            
            
                
                    
                    
                        org.apache.maven.plugins
                        maven-source-plugin
                        3.0.1
                        
                            
                                package
                                
                                    jar-no-fork
                                
                            
                        
                    
                    
                    
                        org.apache.maven.plugins
                        maven-javadoc-plugin
                        2.10.4
                        
                            
                                package
                                
                                    jar
                                
                            
                        
                    
                    
                    
                        org.apache.maven.plugins
                        maven-gpg-plugin
                        1.6
                        
                            
                                sign-artifacts
                                verify
                                
                                    sign
                                
                            
                        
                    
                
            
        
    

发布

mvn clean deploy -P release -Dgpg.passphrase=xxxx

仓库查看

https://oss.sonatype.org/content/repositories/snapshots/

doc

  • 发布Maven构件到中央仓库
  • 将 Smart 构件发布到 Maven 中央仓库
  • 将项目发布到Maven中央库

想获取最新内容,请关注微信公众号

qrcode_for_gh_121b87c80448_258.jpg

你可能感兴趣的:(maven仓库jar包发布指南)