为了让Maven用户利用项目生成的构件,必须将它们部署到maven center repository。 许多开源项目希望允许使用Maven构建的项目用户透明地访问项目的构件。 为了实现这一点,项目应该将其构件部署到中央存储库。
简单来说就是将我们自己写好的文件上传到maven中央仓库,其他人想用就可以通过依赖的方式去引入。
需求:
releases: only releases can be uploaded to the Central Repository, that means files that won’t change and that only depend on other files already released and available in the repository,(只能是正式包,并且上传的文件只能依赖于中央仓库里面含有的依赖)
javadoc and sources for IDE lookup(提供Java文档和源代码,遵循Maven存储库格式),
格式命名:artifactId-version-classifier.packaging
例如:
example-application-1.4.7-sources.jar
example-application-1.4.7-javadoc.jar
PGP signature(一种签名,具体啥的还得百度下才知道),
所有部署的文件都需要使用GPG/PGP进行签名,每个文件都必须包含一个包含签名.asc文件。
例如:
example-application-1.4.7-sources.jar.asc
example-application-1.4.7-javadoc.jar.asc
minimum POM information: There are some requirements for the minimal information in the POMs that are in the Central Repository, see here(为了保证能用,对POM文件的一些要求),
coordinates: Picking the appropriate coordinates for your project is important. See the guidelines here, particularly on groupId and domain ownership.(坐标,参考上面第4点的Correct Coordinates)
Publishing your artifacts to the Central Repository
Approved Repository Hosting
必须使用官方认证的库
Apache Software Foundation (for all Apache projects)
see the full list
Other Projects
The easiest way to upload another project is to use the Open Source Software Repository Hosting (OSSRH), which is an approved repository provided by Sonatype for any OSS Project that want to get their artifacts into the Central Repository.