Publishing to Maven Repository through gradle

I am struggling to publish artifacts to Maven repository (Packages) through gradle.
Note: Publishing using pom worked as expected.

Here’s what i tried so far. (Note: it’s kotlin DSL syntax)

publishing {
publications {
create(“mavenJava”) {
repositories {
maven {
name = “gitlab-maven”
url = uri(“”)
credentials(HttpHeaderCredentials::class) {
name = “Private-Token”
value = “TOKEN”
authentication {

When i try to publish everything go through fine without any error BUT i can’t see anything gets uploaded to packages.

NOTE: Publishing to Local works just fine.

I would appreciate any pointers where exactly i am making any mistake.



Do we have similar documentation for Gradle?

It would be nice if someone can answer this. Is there any other speedy way to get to other end for answer ?


I have a similar problem. CI pipeline successfully completed for different version of artifacts with 1.0 and 1.0-SNAPSHOT, but gitlab packages list shows only the first package with 1.0 version and without 1.0-SNAPSHOT. Packages API returns the same result - 1.0 version exists and 1.0-SNAPSHOT does not exist. What is the problem? Can not find any docs which provide this stuff (gradle+maven publish plugin+gitlab maven repo).

1 Like

Did you ever find a solution to this?

@divan It is a bug, see on this flow