{"record":{"id":"0a65da2dc3644852","repo":"elastic/elasticsearch","slug":"usage-of-deprecated-classname-in-projectpath","errorCode":null,"errorMessage":"Usage of deprecated ${className} in ${projectPath}","messagePattern":"Usage of deprecated (.+?) in (.+?)","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java","lineNumber":63,"sourceCode":"        map.put(LegacyRestTestBasePlugin.class, \":x-pack:qa:rolling-upgrade-legacy\");\n        map.put(LegacyRestTestBasePlugin.class, \":x-pack:qa:rolling-upgrade-basic\");\n        map.put(LegacyRestTestBasePlugin.class, \":x-pack:plugin:eql:qa:ccs-rolling-upgrade\");\n        map.put(LegacyRestTestBasePlugin.class, \":x-pack:plugin:ml:qa:multi-cluster-tests-with-security\");\n        map.put(LegacyRestTestBasePlugin.class, \":x-pack:plugin:shutdown:qa:rolling-upgrade\");\n        map.put(LegacyRestTestBasePlugin.class, \":x-pack:plugin:transform:qa:multi-cluster-tests-with-security\");\n\n        // Projects that inherit the legacy-yaml-rest-test plugin from their parent's subprojects { } configuration.\n        map.put(LegacyRestTestBasePlugin.class, \":x-pack:qa:runtime-fields:core-with-mapped\");\n        map.put(LegacyRestTestBasePlugin.class, \":x-pack:qa:runtime-fields:core-with-search\");\n        return map;\n    }\n\n    public void failOnUsageRestriction(Class<?> aClass, Project project) {\n        if (getParameters().getDisabled().getOrElse(false)) {\n            return;\n        }\n        if (isSupported(aClass, project.getPath()) == false) {\n            throw new GradleException(\"Usage of deprecated \" + aClass.getName() + \" in \" + project.getPath());\n        }\n    }\n\n    private boolean isSupported(Class<?> aClass, String path) {\n        return usageWhitelist.get(aClass).contains(path);\n    }\n\n    public abstract static class Params implements BuildServiceParameters {\n        public abstract Property<Boolean> getDisabled();\n    }\n}\n","sourceCodeStart":45,"sourceCodeEnd":75,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/RestrictedBuildApiService.java#L45-L75","documentation":"Thrown by RestrictedBuildApiService.failOnUsageRestriction when a Gradle project uses a deprecated/restricted build-API class and that project's path is not on the usageWhitelist for that class. The service is a Gradle BuildService that gates adoption of internal/legacy plugins (currently LegacyRestTestBasePlugin) to a fixed set of grandfathered projects, forcing all new code onto the supported replacement.","triggerScenarios":"failOnUsageRestriction(aClass, project) is called (typically from a plugin-detection hook). If the disabled param is unset/false AND isSupported(aClass, project.getPath()) is false (i.e. usageWhitelist.get(aClass) does not contain the project path), it throws. The whitelist currently maps LegacyRestTestBasePlugin to ~20 specific :x-pack:... and :qa:... paths.","commonSituations":"A new project applies LegacyRestTestBasePlugin (directly or via legacy-yaml-rest-test/legacy-java-rest-test/standalone-rest-test) but is not in the whitelist; copying a rest-test submodule that inherits the legacy plugin; adding an x-pack qa project without migrating to the new yaml-rest-test setup.","solutions":["Do NOT silence by disabling the service globally. Instead, migrate the new project to the supported REST test plugin (the modern yaml-rest-test / standalone-rest-test replacement that does not apply LegacyRestTestBasePlugin).","If the usage is legitimate and permanent (e.g. a new grandfathered migration qa project), add the project path to the appropriate group in createLegacyRestTestBasePluginUsage() with a comment justifying why migration is not yet possible.","To temporarily unblock local exploration, pass -Dorg.elasticsearch.gradle.build-api-restriction.disabled=true (the BUILD_API_RESTRICTIONS_SYS_PROPERTY) — but do not commit reliance on this."],"exampleFix":"// before: new project :x-pack:plugin:foo:qa:rest applies legacy-yaml-rest-test -> fails\n// after option A (preferred): use the modern yaml rest test plugin instead\n// after option B (last resort, with justification): whitelist it\n//   map.put(LegacyRestTestBasePlugin.class, \":x-pack:plugin:foo:qa:rest\");","handlingStrategy":"validation","validationCode":"// Before applying a restricted plugin, check the whitelist programmatically:\nboolean allowed = usageWhitelist.get(LegacyRestTestBasePlugin.class)\n    .contains(project.getPath());\nif (!allowed) {\n    throw new GradleException(\n        \"Refusing to apply LegacyRestTestBasePlugin in \" + project.getPath()\n        + \"; migrate to the modern yaml-rest-test plugin.\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Migrate new REST test projects to the modern yaml-rest-test plugin family; do not apply LegacyRestTestBasePlugin.","If grandfathering is unavoidable, add the path to createLegacyRestTestBasePluginUsage() with a justifying comment.","Reserve -Dorg.elasticsearch.gradle.build-api-restriction.disabled=true for local triage only."],"tags":["gradle","build-api","deprecation","restricted-api","rest-tests"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}