I'm trying to bublish release into GitLab. I've configured gradle task as discribed in official GitLab docs.
maven {
name = "GitLab"
url = uri("https://" + System.getenv("CI_SERVER_HOST") + "/api/v4/projects/" + System.getenv("CI_PROJECT_ID") + "/packages/maven")
credentials(HttpHeaderCredentials) {
name = "Job-Token"
value = System.getenv("CI_JOB_TOKEN")
}
authentication {
header( HttpHeaderAuthentication )
}
}
And, in pipeline, it fails with:
* What went wrong:
A problem was found with the configuration of task ':publishLibraryPublicationToLaptevTechRepository' (type 'PublishToMavenRepository').
- In plugin 'org.gradle.api.publish.maven.plugins.MavenPublishPlugin$Inject' type 'org.gradle.api.publish.maven.tasks.PublishToMavenRepository' property 'credentials.username' doesn't have a configured value.
Reason: This property isn't marked as optional and no value has been configured.
Possible solutions:
1. Assign a value to 'credentials.username'.
2. Mark property 'credentials.username' as optional.