苏州网站建设的一般流程,大型网站开发成本,淮南发布,手机网站开发工具发布自己的项目到maven中央仓库
Maven Central Account
访问#xff1a;https://central.sonatype.com/#xff0c;点击右上角#xff0c;根据提示注册账号 构建User token #xff0c;用于访问中央仓库的API#xff1a; 点击右上角#xff0c;查看账户点击Generate Us…发布自己的项目到maven中央仓库
Maven Central Account
访问https://central.sonatype.com/点击右上角根据提示注册账号 构建User token 用于访问中央仓库的API 点击右上角查看账户点击Generate User Token根据提示构建个人访问令牌将获取的User Token xml代码配置到maven配置文件settings.xml 的servers属性中
POM.xml
配置需要发布的项目中的POM.xml文件
配置编译项目的java版本
propertiesmaven.compiler.source11/maven.compiler.sourcemaven.compiler.target11/maven.compiler.targetjava.version11/java.version
/properties配置项目名称、项目地址、打包方式
namexx xx/name
descriptiondesc/description
urlhttps://github.com/xx/xx.xx.xx/url
packagingpom/packaging配置私库地址 仓库地址分为正式版releases repository和预览版snapshot repositoryid在settings.xml中配置的server idname仓库名称ur对应的私库地址
distributionManagementrepositoryidcentral/idnameMaven Central/nameurlhttps://repo.maven.apache.org/maven2/url/repository
/distributionManagement配置开发者信息、项目开源许可证、代码仓库地址
developersdeveloperid000000000/idnamexxxxxxx/nameemail000000000qq.com/email/developer/developerslicenseslicensenameMIT License/nameurlhttps://opensource.org/licenses/MIT/urldistributionrepo/distribution/license/licensesscmconnectionhttps://github.com/xx/xx.xx.xx.git/connectionurlhttps://github.com/xx/xx.xx.xx/url/scm配置打包插件 maven-source-plugin源代码打包工具中央仓库也会对源代码进行验证maven-javadoc-pluginjavadoc文档打包工具中央仓库会对javadoc经行验证没有文档会验证失败
buildpluginsplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-source-plugin/artifactIdversion${maven-source-plugin.version}/versioninheritedtrue/inheritedexecutionsexecutionidattach-sources/idgoalsgoaljar/goal/goals/execution/executionsconfigurationexcludeResourcestrue/excludeResourcesuseDefaultExcludestrue/useDefaultExcludes/configuration/pluginplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-javadoc-plugin/artifactIdversion${maven-javadoc-plugin.version}/versioninheritedtrue/inheritedexecutionsexecutionidbundle-sources/idphasepackage/phasegoalsgoaljar/goal/goals/execution/executionsconfigurationencodingUTF-8/encodingcharsetUTF-8/charsetshowprotected/shownotreetrue/notreefailOnErrorfalse/failOnErrordoclintnone/doclint/configuration/plugin/plugins
/build配置发布插件 central-publishing-maven-plugin中央仓库发布插件maven-deploy-plugin mavenmaven发布插件任何仓库都需要这个插件maven-gpg-plugin对发布的项目文件进行签名中央仓库会对文件进行验签GPG签名详见https://central.sonatype.org/publish/requirements/gpg/
buildpluginsplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-deploy-plugin/artifactIdversion${maven-deploy-plugin.version}/version/pluginplugingroupIdorg.sonatype.central/groupIdartifactIdcentral-publishing-maven-plugin/artifactIdversion${central-publishing-maven-plugin.version}/versionextensionstrue/extensionsconfigurationpublishingServerIdcentral/publishingServerIdautoPublishtrue/autoPublishwaitUntilpublished/waitUntil/configuration/pluginplugingroupIdorg.apache.maven.plugins/groupIdartifactIdmaven-gpg-plugin/artifactIdversion${maven-gpg-plugin.version}/versionexecutionsexecutionidsign-artifacts/idphaseverify/phasegoalsgoalsign/goal/goalsconfigurationkeyname288F5FE69C7B21AB/keynamepassphraseServerId288F5FE69C7B21AB/passphraseServerId/configuration/execution/executions/plugin/plugins
/build发布
运行发布命令
mvn deploy等待maven central验证如果发布状态不是published那么就是发布失败需要根据提示进行相应的更改
FAQ
Javadocs must be provided but not found in entries因为中央仓库没找到Javadoc文档所以需要打包Javadoc文档java 1.8打包doc文档时会报异常建议提升至java11打包Illegal reflective access by lombok.javac.apt.LombokProcessor xxxjava11打包Lombok时需要查看Lombok和java版本是否支持