Skip to content

Gradle Artifactory plugin (v4.24.16) leads to auth errors (401) when using Gradle Wrapper >= v7.x #551

@iwt-tobiasboehm

Description

@iwt-tobiasboehm

Describe the bug
When we upgraded our Android Library project to Gradle wrapper v7.x something changed for the Gradle Artifactory plugin (v4.24.16) that now leads to authentication errors when uploading artifacts (unauthorized error 401). Also our infrastructure team informed us that upload tasks, that were run with a CI pipeline script using gradle 7.x wrapper (does not matter which one, we tried 7.0.2 as well as 7.2), lead to Artifactory access attempts with an anonymous user. The way username/password are provided are still the same.

Config looks like this:

artifactory {
    contextUrl = "https://xxx/artifactory"

    getClientConfig().publisher.setPublishBuildInfo(false)
    getClientConfig().publisher.setPublishArtifacts(true)

    publish {
        repository {
            repoKey = isReleaseBuild() ? "maven" : "maven-snapshots"
            username = getRepositoryUsername()
            password = getRepositoryPassword()
            maven = true
        }

        defaults {
            publishArtifacts = true
            publishPom = true
        }
    }
}

getRepositoryUsername() and getRepositoryPassword() read some env vars. However simply replacing them with hardcoded credentials doesn't change anything regarding the gradle 7 behaveiour.

We can make the plugin work again by switching back to Gradle 6.9.1, however we need to switch to Gradle 7 soon for several reasons (android compose / target SDK 30 etc.).

To Reproduce
Try to upload artifacts to an Artifactory service from an Android Library project using Gradle Artifactory plugin (v4.24.16) utilizing a publish { repository { username / password } } config running on Gradle wrapper 7.x. 

Expected behavior
Upload still works.

Versions

  • Gradle Artifactory plugin version: 4.24.16
  • Operating system: OS X Big Sur
  • Artifactory Version: 7.3.2

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gradle bugCreate a report to help us improve

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions