{"record":{"id":"1f242578c87c23f9","repo":"apache/maven","slug":"repository-identifier-missing-1f2425","errorCode":null,"errorMessage":"Repository identifier missing","messagePattern":"Repository identifier missing","errorType":"exception","errorClass":"InvalidRepositoryException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/bridge/MavenRepositorySystem.java","lineNumber":333,"sourceCode":"            modelRepositoryPolicy.setEnabled(settingsRepositoryPolicy.isEnabled());\n            modelRepositoryPolicy.setUpdatePolicy(settingsRepositoryPolicy.getUpdatePolicy());\n            modelRepositoryPolicy.setChecksumPolicy(settingsRepositoryPolicy.getChecksumPolicy());\n        }\n        return modelRepositoryPolicy;\n    }\n\n    public static ArtifactRepository buildArtifactRepository(org.apache.maven.settings.Repository repo)\n            throws InvalidRepositoryException {\n        return buildArtifactRepository(fromSettingsRepository(repo));\n    }\n\n    public static ArtifactRepository buildArtifactRepository(org.apache.maven.model.Repository repo)\n            throws InvalidRepositoryException {\n        if (repo != null) {\n            String id = repo.getId();\n\n            if (id == null || id.isEmpty()) {\n                throw new InvalidRepositoryException(\"Repository identifier missing\", \"\");\n            }\n\n            String url = repo.getUrl();\n\n            if (url == null || url.isEmpty()) {\n                throw new InvalidRepositoryException(\"URL missing for repository \" + id, id);\n            }\n\n            ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy(repo.getSnapshots());\n\n            ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy(repo.getReleases());\n\n            ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();\n\n            return createArtifactRepository(id, url, layout, snapshots, releases);\n        } else {\n            return null;\n        }","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/bridge/MavenRepositorySystem.java#L315-L351","documentation":"MavenRepositorySystem.buildArtifactRepository(model.Repository) validates every `<repository>`/`<pluginRepository>` declaration of a POM before creating the ArtifactRepository; a declaration whose `<id>` is null or empty fails immediately with InvalidRepositoryException 'Repository identifier missing' (exception key is the empty string). The id is the identity used for settings.xml mirror and server matching, so it is mandatory.","triggerScenarios":"A `<repository>` block with `<url>` but no `<id>` (or `<id/>`) in pom.xml, a profile, pluginRepositories, or distributionManagement of a POM being turned into a repository.","commonSituations":"Hand-written or templated repository blocks with placeholder ids never filled in; IDE stanzas inserted incomplete; POMs ported from tools that tolerated missing ids.","solutions":["Find the block: `grep -rn '<repository>' --include=pom.xml .` and add a unique non-empty `<id>`.","Use a stable id if settings.xml mirrors or credentials will be attached to it.","Verify with `mvn validate` or `mvn help:effective-pom` after the fix."],"exampleFix":"<!-- before -->\n<repository>\n  <url>https://repo.example.com/public</url>\n</repository>\n\n<!-- after -->\n<repository>\n  <id>example-public</id>\n  <url>https://repo.example.com/public</url>\n</repository>","handlingStrategy":"validation","validationCode":"for (org.apache.maven.model.Repository r : model.getRepositories()) {\n    if (r.getId() == null || r.getId().isEmpty()) {\n        throw new IllegalArgumentException(\"Repository without <id> in \" + model.getPomFile());\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add a CI POM lint (help:effective-pom + schema check) that flags repository blocks missing id/url.","Templated POMs should fail generation when placeholders like REPO_ID are unfilled."],"tags":["maven","pom","repository","validation"],"backgroundTag":"maven-repository-misconfigured","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}