{"record":{"id":"5f8c1b74ad6c96d0","repo":"SonarSource/sonarqube","slug":"invalid-artifactoryurl","errorCode":null,"errorMessage":"Invalid artifactoryUrl","messagePattern":"Invalid artifactoryUrl","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"build.gradle","lineNumber":114,"sourceCode":"    tasks.matching { it.name.matches(bomTasks) }.all({\n      logger.info(\"{} disabled\", it.name);\n      it.enabled = false\n    })\n  }\n\n  repositories {\n    // For local development: resolve artifacts from local Maven repository\n    mavenLocal()\n\n    // The environment variables ARTIFACTORY_USERNAME and ARTIFACTORY_ACCESS_TOKEN are used on QA env (Jenkins)\n    // On local box, please add artifactoryUsername and artifactoryPassword to ~/.gradle/gradle.properties\n    def artifactoryUsername = System.env.'ARTIFACTORY_USERNAME' ?: (project.hasProperty('artifactoryUsername') ? project.getProperty('artifactoryUsername') : '')\n    def artifactoryPassword = System.env.'ARTIFACTORY_ACCESS_TOKEN' ?: (project.hasProperty('artifactoryPassword') ? project.getProperty('artifactoryPassword') : '')\n    def artifactoryUrl = System.getenv('ARTIFACTORY_URL') ?: (project.hasProperty('artifactoryUrl') ? project.getProperty('artifactoryUrl') : '')\n\n    if (artifactoryPassword) {\n      if (artifactoryUrl == '') {\n        throw new GradleException('Invalid artifactoryUrl')\n      }\n      maven {\n        authentication {\n          header(HttpHeaderAuthentication)\n        }\n        credentials(HttpHeaderCredentials) {\n          name = \"Authorization\"\n          value = \"Bearer $artifactoryPassword\"\n        }\n        url \"${artifactoryUrl}/sonarsource\"\n      }\n      maven {\n        authentication {\n          header(HttpHeaderAuthentication)\n        }\n        credentials(HttpHeaderCredentials) {\n          name = \"Authorization\"\n          value = \"Bearer $artifactoryPassword\"","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/build.gradle#L96-L132","documentation":"When Artifactory credentials are present (ARTIFACTORY_ACCESS_TOKEN env var or artifactoryPassword property), the build also requires a non-empty Artifactory URL (ARTIFACTORY_URL env var or artifactoryUrl property). If the password/token is set but the URL is empty, the build throws GradleException('Invalid artifactoryUrl') before configuring the authenticated Maven repository.","triggerScenarios":"Setting ARTIFACTORY_ACCESS_TOKEN (or gradle property artifactoryPassword) but leaving ARTIFACTORY_URL unset/empty and no artifactoryUrl gradle property defined; e.g. credentials configured in CI secrets but URL secret missing.","commonSituations":"Partial Artifactory configuration where only credentials were provisioned; typo'd env var name for the URL; properties file with artifactoryPassword but no artifactoryUrl key.","solutions":["Set ARTIFACTORY_URL (or gradle property artifactoryUrl) to your Artifactory base URL","Or remove ARTIFACTORY_ACCESS_TOKEN/artifactoryPassword if Artifactory is not needed","Verify in CI that both ARTIFACTORY_URL and ARTIFACTORY_ACCESS_TOKEN secrets are defined"],"exampleFix":"// before\nexport ARTIFACTORY_ACCESS_TOKEN=token   # no URL\n// after\nexport ARTIFACTORY_ACCESS_TOKEN=token\nexport ARTIFACTORY_URL=https://artifactory.example.com/artifactory","handlingStrategy":"validation","validationCode":"// shell: both credentials and URL must be set together\nif [ -n \"$ARTIFACTORY_ACCESS_TOKEN\" ] && [ -z \"$ARTIFACTORY_URL\" ]; then\n  echo \"ARTIFACTORY_URL is required when ARTIFACTORY_ACCESS_TOKEN is set\" >&2\n  exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Configure ARTIFACTORY_URL and ARTIFACTORY_ACCESS_TOKEN as a pair in CI secrets","Keep artifactoryUrl/artifactoryPassword properties together in gradle.properties","If Artifactory is unused, set neither credential nor URL"],"tags":["gradle","artifactory","configuration","build"],"backgroundTag":"missing-required-config-field","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}