Maven-publish plugin: Failed to retrieve remote metadata (maven-metadata.xml)


I am new to gradle and try to publish my artifacts to nexus. I found the maven-publish plugin for this but I didn’t get it working.

Here is my configuration from build.gradle:

publishing {
        repositories {
           maven {
           url "$baseurl/pws-${project.version.endsWith('-SNAPSHOT') ? 'snapshots' : 'releases' }"
           credentials {
              username '$nexusUser'
              password '$nexusPassword'
publishing {
    publications {
        mavenJava(MavenPublication) {
            groupId ''
            artifactId 'artifactId'
            version '0.0.1-SNAPSHOT'

Whenever I run the task “publish” I get the following error:

Failed to publish publication ‘mavenJava’ to repository ‘maven’
> Failed to retrieve remote metadata Could not transfer metadata from/to remote (http://xxxx/xxxxx): Could not get resource ‘com/my/group/id/artifactId/0.1-SNAPSHOT/maven-metadata.xml’

The maven-metadata.xml is not uploaded but I don’t know why.
There is no return value or another error which indicates the problem. Have someone an idea whats going wrong here?

Thanks in advanced

Same issue - no information about what the expectation here is - where does this file come from, what does maven-plugin need to generate it?

@ericcrahensc, @tobiloeb: did you ever find a solution to this problem? Please post it here.

@ericcrahensc @azine please let me know if you solved this issue

solution: credentials were not properly set

1 Like