我想我已经使用 Gradle 将工件的一个版本上传到 MavenCentral,但搜索功能看不到它

I think I have uploaded a version of an artifact to MavenCentral using Gradle, but search function can't see it

我使用Gradle 发布功能将我的神器的最新版本上传到Maven,但是Maven 搜索功能仍然显示以前的版本。奇怪的是,如果我再次发布,它工作正常,直到我从 Nexus Staging Repos 发布版本,当我收到消息说:

RepositoryWritePolicy

failureMessage  Artifact updating: Repository ='releases:Releases' does not allow updating    artifact='/com/jpaulmorrison/drawfbp/maven-metadata.xml.sha512'

failureMessage  Artifact updating: Repository ='releases:Releases' does not allow updating artifact='/com/jpaulmorrison/drawfbp/maven-metadata.xml.sha256' 

这似乎表明我在较早的尝试中设法添加了这个版本……但它没有出现在 Maven 搜索中……

我现在正在使用 Gradle 6.2.2 和 Win10 - 这些年来我已经能够使用 Gradle 5 发布许多工件,但是 Gradle 6 发生了重大变化.我想我已经让它工作了,但我似乎无法发布一个工件的任何更高版本。

我确实收到了来自 Gradle 'publish' 的消息说 'maven-metadata.xml missing' - 这可能是问题所在吗?这是我从 Gradle 收到的唯一错误消息。但是Build成功了!我也没有看到此工件的 .m2 文件夹。如果这些点很重要,我该如何解决? Maven 是否有我可以查看的任何内部调试以了解发生了什么?为什么 Maven 认为那里有一个版本,但不让我看到它?!我也不想为了让 Maven 接受我的版本而不断修改版本号!

我不确定我的回答是否能解决您的问题,但值得一试。

Maven 几周前禁用了 HTTP 服务。确保您通过 HTTPS 连接到 Maven 存储库。新的 Maven 客户端会自动执行此操作。对于旧版本,您可以从 C:\Users\.m2\settings.xml:

中的以下示例配置文件复制
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
   <profiles>
      <profile>
         <id>artifactory</id>
         <repositories>
            <repository>
               <snapshots>
                  <enabled>false</enabled>
               </snapshots>
               <id>central</id>
               <name>libs-release</name>
               <url>https://repo1.maven.org/maven2/</url>
            </repository>
            <repository>
               <snapshots />
               <id>snapshots</id>
               <name>libs-snapshot</name>
               <url>https://repo1.maven.org/maven2/</url>
            </repository>
         </repositories>
         <pluginRepositories>
            <pluginRepository>
               <snapshots>
                  <enabled>false</enabled>
               </snapshots>
               <id>central</id>
               <name>plugins-release</name>
               <url>https://repo1.maven.org/maven2/</url>
            </pluginRepository>
            <pluginRepository>
               <snapshots />
               <id>snapshots</id>
               <name>plugins-snapshot</name>
               <url>https://repo1.maven.org/maven2/</url>
            </pluginRepository>
         </pluginRepositories>         
      </profile>
   </profiles>
   <activeProfiles>
      <activeProfile>artifactory</activeProfile>
   </activeProfiles>
</settings>

谢谢,@Stefan,但是 Nexus 人员能够解决这个问题,并提出了一个短期修复方案——长期修复方案在他们的积压工作中:https://issues.sonatype.org/browse/NEXUS-21802

对话可在 https://issues.sonatype.org/browse/MVNCENTRAL-5622 获得。

谢谢!