简体   繁体   中英

Received status code 400 from server: Invalid maven-metadata.xml during publishing artifacts to maven2

I am trying to upload jar artifacts to Nexus repository (maven2 snapshot) and next error is received:

Could not PUT 'http://{path-to-repository}/1.1-snapshot/maven-metadata.xml': Received status code 400 from server: Invalid maven-metadata.xml GAV..., 1.1-snapshot does not match request path 1.1-snapshot/maven-metadata.xml

I am using maven-publish plugin from Gradle script. I have provided code snippet below

afterEvaluate {
    project -> {
        publishing {
            publications {
                maven(MavenPublication) {
                    groupId = 'org.company'
                    version = '1.1-snapshot'

                    from components.java
                }
            }

            repositories {
                maven{
                    url 'http://localhost:8081/repository/maven-custom/'

                    credentials {
                        username 'admin'
                        password 'password'
                    }

                    allowInsecureProtocol = true
                }
            }
        }
    }
}

I have found a lot of similar questions but did not find solution for this particular problem.

I have found what was the reason. I am an idiot. I have changed from

version '1.0-snapshot'

to

version '1.1-SNAPSHOT'

in Gradle script.

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