{"record":{"id":"46f413b76381c632","repo":"apache/maven","slug":"url-missing-for-repository","errorCode":null,"errorMessage":"URL missing for repository {}","messagePattern":"URL missing for repository (.+?)","errorType":"exception","errorClass":"InvalidRepositoryException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/bridge/MavenRepositorySystem.java","lineNumber":339,"sourceCode":"\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        }\n    }\n\n    public static ArtifactRepositoryPolicy buildArtifactRepositoryPolicy(\n            org.apache.maven.model.RepositoryPolicy policy) {\n        boolean enabled = true;\n","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/bridge/MavenRepositorySystem.java#L321-L357","documentation":"A POM `<repository>` declaration passed id validation but its `<url>` is null or empty, so MavenRepositorySystem.buildArtifactRepository throws InvalidRepositoryException 'URL missing for repository <id>' carrying the repository id. Without a URL there is nothing to resolve from, so the declaration is rejected rather than defaulted.","triggerScenarios":"`<repository><id>x</id></repository>` with the url element missing or empty - frequently a `<url>${repo.url}</url>` placeholder whose property is undefined in the active profile or settings, interpolating to empty.","commonSituations":"Property-driven repository URLs where the property lives in an inactive profile, a private settings.xml not present in CI, or an environment-specific file that was never committed.","solutions":["Add a valid non-empty `<url>` to the repository whose id appears in the message.","If the url uses ${...}, verify the property resolves in every build context (profile active, settings present, -D passed).","Delete the repository block if it is an unused leftover."],"exampleFix":"<!-- before -->\n<repository>\n  <id>corp-releases</id>\n</repository>\n\n<!-- after -->\n<repository>\n  <id>corp-releases</id>\n  <url>https://repo.corp/releases</url>\n</repository>","handlingStrategy":"validation","validationCode":"for (org.apache.maven.model.Repository r : model.getRepositories()) {\n    if (r.getUrl() == null || r.getUrl().isEmpty()) {\n        throw new IllegalArgumentException(\"Repository \" + r.getId() + \" has empty <url> in \" + model.getPomFile());\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer literal URLs over ${...} placeholders in repository declarations.","When placeholders are required, define them in settings.xml or always-active profiles present in CI too."],"tags":["maven","pom","repository","url","validation"],"backgroundTag":"maven-repository-misconfigured","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}