2024-08-29 11:41:15 292 0
在发布至maven仓库时,报了如下错误:
[INFO] --- central-publishing-maven-plugin:0.5.0:publish (injected-central-publishing) @ ezadmin-core ---
[WARNING] Error injecting: org.sonatype.central.publisher.plugin.PublishMojo
com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) No implementation for org.sonatype.central.publisher.client.PublisherClient was bound.
while locating org.sonatype.central.publisher.plugin.PublishMojo
折腾了几天,一直没有解决,
maven版本 3.3
有说版本太低的,切换到3.9依然不行。
由于急着发布,暂时先使用 Publish components模块。
对jar包手动上传。
首先需要把一下格式的文件组合,打成一个zip包在 https://central.sonatype.com/publishing/deployments 上传。
$ tree
.
`-- com
`-- sonatype
`-- central
`-- example
`-- example_java_project
`-- 0.1.0
|-- example_java_project-0.1.0-javadoc.jar
|-- example_java_project-0.1.0-javadoc.jar.asc
|-- example_java_project-0.1.0-javadoc.jar.md5
|-- example_java_project-0.1.0-javadoc.jar.sha1
|-- example_java_project-0.1.0-sources.jar
|-- example_java_project-0.1.0-sources.jar.asc
|-- example_java_project-0.1.0-sources.jar.md5
|-- example_java_project-0.1.0-sources.jar.sha1
|-- example_java_project-0.1.0.jar
|-- example_java_project-0.1.0.jar.asc
|-- example_java_project-0.1.0.jar.md5
|-- example_java_project-0.1.0.jar.sha1
|-- example_java_project-0.1.0.pom
|-- example_java_project-0.1.0.pom.asc
|-- example_java_project-0.1.0.pom.md5
`-- example_java_project-0.1.0.pom.sha1
默认是没有md5加密与sha1加密的,需要用到如下插件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<checksum file="/Users/hp/.m2/repository/io/github/ezadmin126/ezadmin-core/2.9.15/ezadmin-core-2.9.15.jar" algorithm="MD5" fileext=".md5"/>
<checksum file="/Users/hp/.m2/repository/io/github/ezadmin126/ezadmin-core/2.9.15/ezadmin-core-2.9.15.jar" algorithm="SHA" fileext=".sha1"/>
<checksum file="/Users/xx/.m2/repository/io/github/ezadmin126/ezadmin-core/2.9.15/ezadmin-core-2.9.15-javadoc.jar" algorithm="MD5" fileext=".md5"/>
<checksum file="/Users/xx/.m2/repository/io/github/ezadmin126/ezadmin-core/2.9.15/ezadmin-core-2.9.15-javadoc.jar" algorithm="SHA" fileext=".sha1"/>
<checksum file="/Users/xx/.m2/repository/io/github/ezadmin126/ezadmin-core/2.9.15/ezadmin-core-2.9.15-sources.jar" algorithm="MD5" fileext=".md5"/>
<checksum file="/Users/xx/.m2/repository/io/github/ezadmin126/ezadmin-core/2.9.15/ezadmin-core-2.9.15-sources.jar" algorithm="SHA" fileext=".sha1"/>
<checksum file="/Users/xx/.m2/repository/io/github/ezadmin126/ezadmin-core/2.9.15/ezadmin-core-2.9.15.pom" algorithm="MD5" fileext=".md5"/>
<checksum file="/Users/xx/.m2/repository/io/github/ezadmin126/ezadmin-core/2.9.15/ezadmin-core-2.9.15.pom" algorithm="SHA" fileext=".sha1"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
今天有空再对比了一下老电脑。
最终使用maven版本 3.6.3 解决, 所以。。。^_^