{"record":{"id":"9a4262a700aa1055","repo":"gradle/gradle","slug":"a-direct-library-binary-dependency-must-have-all-o","errorCode":null,"errorMessage":"A direct library binary dependency must have all of project, library name and variant specified.","messagePattern":"A direct library binary dependency must have all of project, library name and variant specified\\.","errorType":"exception","errorClass":"IllegalDependencyNotation","httpStatus":null,"severity":"error","filePath":"platforms/native/plugins-model-native/src/main/java/org/gradle/platform/base/internal/DefaultLibraryBinaryDependencySpec.java","lineNumber":35,"sourceCode":"\nimport com.google.common.base.Joiner;\nimport org.gradle.api.IllegalDependencyNotation;\nimport org.gradle.api.artifacts.component.LibraryBinaryIdentifier;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Objects;\n\n@SuppressWarnings(\"deprecation\")\npublic class DefaultLibraryBinaryDependencySpec implements org.gradle.platform.base.LibraryBinaryDependencySpec {\n\n    private final String projectPath;\n    private final String libraryName;\n    private final String variant;\n\n    public DefaultLibraryBinaryDependencySpec(String projectPath, String libraryName, String variant) {\n        if (libraryName == null || projectPath == null || variant == null) {\n            throw new IllegalDependencyNotation(\"A direct library binary dependency must have all of project, library name and variant specified.\");\n        }\n        this.libraryName = libraryName;\n        this.projectPath = projectPath;\n        this.variant = variant;\n    }\n\n    @Override\n    public String getProjectPath() {\n        return projectPath;\n    }\n\n    @Override\n    public String getLibraryName() {\n        return libraryName;\n    }\n\n    @Override\n    public String getVariant() {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/gradle/gradle/blob/534f27719b66953f95cc907aae7f2c1b12f5482d/platforms/native/plugins-model-native/src/main/java/org/gradle/platform/base/internal/DefaultLibraryBinaryDependencySpec.java#L17-L53","documentation":"DefaultLibraryBinaryDependencySpec is the spec for depending on one exact binary variant of a library. Its constructor demands all three coordinates — projectPath, libraryName, variant — and throws IllegalDependencyNotation if any is null. The only production factory is of(LibraryBinaryIdentifier), so a null coordinate almost always means the identifier was incomplete (no project path or no variant).","triggerScenarios":"Constructing the spec directly with a missing argument, or of(LibraryBinaryIdentifier) where the identifier carries a null projectPath or variant (e.g. a binary id built without a variant dimension). Thrown at spec-build time, i.e. when DependencySpecContainer.getDependencies() materializes specs.","commonSituations":"Plugin code building binary-level dependency specs from partial identifiers; wiring IDE/tooling features that record 'this binary depends on that exact binary' when the source identifier lacks a project or variant.","solutions":["Populate all three fields on the source LibraryBinaryIdentifier before converting it (projectPath, libraryName, variant).","If the variant genuinely has no flavor/buildType dimension, still pass a non-null variant name (e.g. the default variant the binary reports) rather than null.","If you only mean 'this project's library' (not an exact variant), use DefaultProjectDependencySpec (dependencies { project(path).library(name) }) instead."],"exampleFix":"// before\nnew DefaultLibraryBinaryDependencySpec(null, 'common', null)   // IllegalDependencyNotation\n// after: derive a complete spec from a fully-populated identifier\ndef id = binary.getId()   // LibraryBinaryIdentifier with projectPath, libraryName, variant\nDefaultLibraryBinaryDependencySpec.of(id)","handlingStrategy":"validation","validationCode":"// Validate the identifier is complete before building the spec:\ndef toSpec = { LibraryBinaryIdentifier id ->\n    if (id.projectPath == null || id.libraryName == null || id.variant == null) {\n        throw new GradleException(\"Incomplete binary identifier: project=${id.projectPath} lib=${id.libraryName} variant=${id.variant}\")\n    }\n    DefaultLibraryBinaryDependencySpec.of(id)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat (project, library, variant) as one atomic coordinate: validate all three before constructing the spec","If you only need project+library granularity, use ProjectDependencySpec instead of the binary-level spec","In plugin code, never build LibraryBinaryIdentifier instances with nullable fields"],"tags":["gradle","native","dependency-notation","software-model"],"backgroundTag":"invalid-dependency-notation","analyzedSha":"534f27719b66953f95cc907aae7f2c1b12f5482d","analyzedAt":"2026-08-22T08:09:12.375Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}