简体   繁体   中英

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

I used the Gradle publish function to upload the latest release of my artifact to Maven, but the Maven search function still shows the previous one. What is strange is that, if I do the publish again, it works fine until I Release the version from the Nexus Staging Repos, when I get messages saying:

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' 

which seems to suggest that I managed to add this version on an earlier attempt... but it doesn't show up in Maven search...

I am now using Gradle 6.2.2 and Win10 - I have been able to publish a number of artifacts over the years using Gradle 5, but Gradle 6 changed significantly. I think I have gotten it working, but I can't seem to be able to publish any later versions of one artifact.

I did get a message from Gradle 'publish' saying 'maven-metadata.xml missing' - could this be the problem? It's the only error message I get from Gradle. But the Build was successful! I also don't see an .m2 folder for this artifact. If these points are significant, how do I fix them? Does Maven have any internal debugging I can look at to see what's going on? Why does Maven think there is a version there, but won't let me see it?! I also don't want have to keep bumping the version number to get Maven to accept my version!

I am not sure if my answer will solve your problem but it's worth a try.

Maven disabled the HTTP service a few weeks ago. Ensure that you connect via HTTPS to the maven repository. Fresh maven clients do this automatically. For older releases you may copy from the following example configuration file in 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>

Thanks, @Stefan, but the Nexus people were able to solve this problem, and suggest a short term fix - a long term fix is in their backlog: https://issues.sonatype.org/browse/NEXUS-21802 .

The conversation is available at https://issues.sonatype.org/browse/MVNCENTRAL-5622 .

Thanks anyway!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM