IndianerJones
06/25/2025, 6:33 AMrepositories {
inherits true
grailsCentral()
mavenCentral()
mavenRepo("<https://gitlab.company.net/api/v4/groups/dev/-/packages/maven>") {
auth([
username: "oauth",
password: props.get("gitlabMavenPassword") as String ?: System.getenv("CI_JOB_TOKEN")
])
}
}
Since the change, Grails only sends the authentication header after receiving a 401 response, but GitLab now expects the authentication header on the very first request (preemptive authentication).
I tried something like this (hoping to force preemptive authentication):
repositories {
inherits true
grailsCentral()
mavenCentral()
mavenRepo("<https://gitlab.company.net/api/v4/groups/dev/-/packages/maven>") {
auth([
username: "oauth",
password: props.get("gitlabMavenPassword") as String ?: System.getenv("CI_JOB_TOKEN"),
type : "basic"
])
}
}
But it doesn’t seem to help—Grails still only sends the header after the 401 response.
Question:
Is there a way to configure Grails (in BuildConfig.groovy or elsewhere) to force sending the authentication header on the first request (i.e., enable preemptive HTTP Basic Auth for Maven repositories)? Or is there another workaround for this situation?
Thanks in advance for your help!Steve Osguthorpe
06/25/2025, 10:49 AMIndianerJones
06/25/2025, 11:50 AMgrails.project.dependency.resolver = "maven"
So my hope is that you are right and we just need to activate preemptive authentication with a flag, but I wasn't able to find a documentation for thatSteve Osguthorpe
06/25/2025, 12:36 PMIndianerJones
06/26/2025, 7:29 AMIndianerJones
07/03/2025, 7:27 AMSteve Osguthorpe
07/03/2025, 7:31 AM