{"record":{"id":"e204579d2bde2eae","repo":"apache/maven","slug":"invalid-remote-repository","errorCode":null,"errorMessage":"Invalid remote repository {}","messagePattern":"Invalid remote repository (.+?)","errorType":"exception","errorClass":"ProjectBuildingException","httpStatus":null,"severity":"error","filePath":"compat/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java","lineNumber":150,"sourceCode":"         * This provides backward-compat with 2.x that allowed plugins like the maven-remote-resources-plugin:1.0 to\n         * populate the builder configuration with model repositories instead of artifact repositories.\n         */\n\n        if (repositories != null) {\n            boolean normalized = false;\n\n            List<ArtifactRepository> repos = new ArrayList<>(repositories.size());\n\n            for (Object repository : repositories) {\n                if (repository instanceof Repository repositoryInstance) {\n                    try {\n                        ArtifactRepository repo = repositorySystem.buildArtifactRepository(repositoryInstance);\n                        repositorySystem.injectMirror(request.getRepositorySession(), Arrays.asList(repo));\n                        repositorySystem.injectProxy(request.getRepositorySession(), Arrays.asList(repo));\n                        repositorySystem.injectAuthentication(request.getRepositorySession(), Arrays.asList(repo));\n                        repos.add(repo);\n                    } catch (InvalidRepositoryException e) {\n                        throw new ProjectBuildingException(\"\", \"Invalid remote repository \" + repository, e);\n                    }\n                    normalized = true;\n                } else {\n                    repos.add((ArtifactRepository) repository);\n                }\n            }\n\n            if (normalized) {\n                return repos;\n            }\n        }\n\n        return (List<ArtifactRepository>) repositories;\n    }\n\n    private ProjectBuildingException transformError(ProjectBuildingException e) {\n        if (e.getCause() instanceof ModelBuildingException) {\n            return new InvalidProjectModelException(e.getProjectId(), e.getMessage(), e.getPomFile());","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/compat/maven-compat/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java#L132-L168","documentation":"Thrown by the legacy DefaultMavenProjectBuilder while converting <repositories> declared in a POM into ArtifactRepository instances. repositorySystem.buildArtifactRepository() (followed by mirror/proxy/auth injection) throws InvalidRepositoryException when the repository definition is unusable - typically an invalid id or malformed URL - and it is rethrown as ProjectBuildingException with message 'Invalid remote repository <definition>'.","triggerScenarios":"A POM <repositories><repository> entry with a malformed URL (wrong/unknown protocol, unparseable URI) or an otherwise invalid definition (bad id characters, unreadable layout) such that buildArtifactRepository or the inject* calls fail during project building.","commonSituations":"Typos in repository URLs (e.g. 'htp://', missing scheme, stray spaces or ${} left unresolved); internal Nexus/Artifactory URLs copied with placeholders; plugin/publisher POMs with exotic protocols not enabled in the resolver; corporate mirrors defined via settings.xml conflicting with POM entries.","solutions":["Inspect the exact repository element echoed in the message and fix its <url> and <id> (scheme, host, path, no unresolved properties)","Verify the URL opens outside Maven (curl) and uses a supported protocol (https/http)","Move environment-specific repos to settings.xml profiles instead of the POM, so CI machines get correct mirrors","If the repo sits in a parent POM you do not control, override or neutralize it in settings.xml","Rebuild with -X to see which inject* step rejected the repository"],"exampleFix":"<!-- before -->\n<repositories>\n  <repository>\n    <id>corp</id>\n    <url>htp://nexus.corp.example/repo</url>\n  </repository>\n</repositories>\n<!-- after -->\n<repositories>\n  <repository>\n    <id>corp</id>\n    <url>https://nexus.corp.example/repo</url>\n  </repository>\n</repositories>","handlingStrategy":"validation","validationCode":"// Sanity-check a repository definition before building a project with it\nURI u = URI.create(repository.getUrl());\nif (u.getScheme() == null || !(\"http\".equals(u.getScheme()) || \"https\".equals(u.getScheme()))) {\n    throw new IllegalArgumentException(\"Unsupported repo URL: \" + repository.getUrl());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep repository URLs literal https:// in POMs; resolve properties before committing","Centralize environment-specific repos in settings.xml profiles","Test URLs with curl before adding them to builds"],"tags":["maven","repository","pom","url","legacy"],"backgroundTag":"invalid-repository-url","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}