{"record":{"id":"b7f341d604998741","repo":"elastic/elasticsearch","slug":"missing-from-setting-for-license-name-mapping","errorCode":null,"errorMessage":"Missing \"from\" setting for license name mapping","messagePattern":"Missing \"from\" setting for license name mapping","errorType":"exception","errorClass":"InvalidUserDataException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/AbstractDependenciesTask.java","lineNumber":33,"sourceCode":"import org.gradle.api.tasks.Input;\nimport org.gradle.api.tasks.Optional;\n\nimport java.util.Map;\n\npublic abstract class AbstractDependenciesTask extends DefaultTask {\n\n    @Input\n    @Optional\n    public abstract MapProperty<String, String> getMappings();\n\n    /**\n     * Add a mapping from a regex pattern for the jar name, to a prefix to find\n     * the LICENSE and NOTICE file for that jar.\n     */\n    public void mapping(Map<String, String> props) {\n        String from = props.get(\"from\");\n        if (from == null) {\n            throw new InvalidUserDataException(\"Missing \\\"from\\\" setting for license name mapping\");\n        }\n        String to = props.get(\"to\");\n        if (to == null) {\n            throw new InvalidUserDataException(\"Missing \\\"to\\\" setting for license name mapping\");\n        }\n        if (props.size() > 2) {\n            throw new InvalidUserDataException(\"Unknown properties for mapping on dependencyLicenses: \" + props.keySet());\n        }\n        getMappings().put(from, to);\n    }\n}\n","sourceCodeStart":15,"sourceCodeEnd":45,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/AbstractDependenciesTask.java#L15-L45","documentation":"Thrown by AbstractDependenciesTask.mapping when the supplied map lacks the required \"from\" key. A mapping links a regex matching a jar name to a prefix used to locate that jar's LICENSE and NOTICE files; both \"from\" and \"to\" are mandatory.","triggerScenarios":"Calling dependencyLicenses.mapping([:]) or dependencyLicenses.mapping(['to': 'lucene']) in a build.gradle, omitting the from entry.","commonSituations":"Build-script typo; copying a mapping block and dropping a key; constructing the map programmatically and forgetting one entry.","solutions":["Add the 'from' key with the jar-name regex to the mapping map.","Use the documented map literal form mapping(from: '<regex>', to: '<prefix>').","Check the surrounding dependencyLicenses block for a malformed closure."],"exampleFix":"// before\ndependencyLicenses.mapping(['to': 'lucene'])\n// after\ndependencyLicenses.mapping(from: 'lucene-core', to: 'lucene')","handlingStrategy":"validation","validationCode":"if (props.get(\"from\") == null) {\n    throw new InvalidUserDataException(\"Missing \\\"from\\\" setting for license name mapping\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the named-argument form mapping(from: '...', to: '...') in Groovy DSL so missing keys are obvious.","Lint build scripts for mapping calls with exactly two keys.","Keep a single canonical example of a mapping block for contributors to copy."],"tags":["gradle","licensing","build-script","build-tools"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}