{"record":{"id":"38e6a1a968a55c57","repo":"apache/maven","slug":"no-versions-are-present-in-the-repository-for-the","errorCode":null,"errorMessage":"No versions are present in the repository for the artifact with a range \" + versionRange","messagePattern":"No versions are present in the repository for the artifact with a range \" \\+ versionRange","errorType":"exception","errorClass":"OverConstrainedVersionException","httpStatus":null,"severity":"error","filePath":"compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java","lineNumber":473,"sourceCode":"                                    // TODO maybe its better to just pass the range through to retrieval and use a\n                                    // transformation?\n                                    ArtifactVersion version;\n                                    if (!artifact.isSelectedVersionKnown()) {\n                                        List<ArtifactVersion> versions = artifact.getAvailableVersions();\n                                        if (versions == null) {\n                                            versions = source.retrieveAvailableVersions(metadataRequest);\n                                            artifact.setAvailableVersions(versions);\n                                        }\n\n                                        Collections.sort(versions);\n\n                                        VersionRange versionRange = artifact.getVersionRange();\n\n                                        version = versionRange.matchVersion(versions);\n\n                                        if (version == null) {\n                                            if (versions.isEmpty()) {\n                                                throw new OverConstrainedVersionException(\n                                                        \"No versions are present in the repository for the artifact\"\n                                                                + \" with a range \" + versionRange,\n                                                        artifact,\n                                                        childRemoteRepositories);\n                                            }\n\n                                            throw new OverConstrainedVersionException(\n                                                    \"Couldn't find a version in \" + versions + \" to match range \"\n                                                            + versionRange,\n                                                    artifact,\n                                                    childRemoteRepositories);\n                                        }\n                                    } else {\n                                        version = artifact.getSelectedVersion();\n                                    }\n\n                                    artifact.selectVersion(version.toString());\n                                    fireEvent(ResolutionListener.SELECT_VERSION_FROM_RANGE, listeners, child);","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/DefaultLegacyArtifactCollector.java#L455-L491","documentation":"In DefaultLegacyArtifactCollector's ranged-version handling, the list of available versions retrieved from repository metadata came back empty (after sorting), so versionRange.matchVersion(versions) returned null and versions.isEmpty() is true. OverConstrainedVersionException is thrown with 'No versions are present in the repository for the artifact with a range <range>', carrying the artifact and the child remote repositories that were searched.","triggerScenarios":"A dependency declared with a version range where retrieveAvailableVersions returns an empty list: the artifact's maven-metadata.xml lists no versions, or the artifact does not exist at all in the searched repositories (wrong groupId/artifactId, repo not reachable, or artifact never deployed).","commonSituations":"Typo in groupId/artifactId so no metadata is ever found; relying on an internal repository that does not mirror the needed repo; the artifact was renamed or never released; offline/local-only resolution where the metadata was never cached; snapshot-only artifacts where release metadata is absent.","solutions":["Verify groupId/artifactId of the ranged dependency against the search page of your repository manager","Confirm the repository hosting the artifact is actually declared and reachable in the current build (mvn help:effective-pom, and check mirror rules in settings.xml)","Refresh with mvn -U in case cached empty metadata is stale","If this is a first-release situation, publish at least one version of the artifact before depending on it via a range"],"exampleFix":"# before: artifact not in any declared repo\nmvn verify   # -> No versions are present in the repository ...\n\n# after: add the repository that actually hosts it\n<repositories>\n  <repository>\n    <id>example-releases</id>\n    <url>https://repo.example.com/releases</url>\n  </repository>\n</repositories>\nmvn -U verify","handlingStrategy":"validation","validationCode":"// Pre-flight: confirm at least one version is available for the ranged dependency\nList<ArtifactVersion> versions = metadataSource.retrieveAvailableVersions(request);\nif (versions == null || versions.isEmpty()) {\n    throw new IllegalStateException(\n            \"No versions found for \" + artifact + \" — verify groupId/artifactId and repositories\");\n}","typeGuard":null,"tryCatchPattern":"catch (OverConstrainedVersionException e) {\n    if (e.getMessage().contains(\"No versions are present\")) {\n        // artifact metadata absent entirely: check coordinates and repo access\n        guideUserToCheckCoordinates(artifact, childRemoteRepositories);\n    } else {\n        // versions exist but none match: adjust the range\n        guideUserToAdjustRange(artifact);\n    }\n}","preventionTips":["Verify coordinates against the repository manager's search UI before adding a ranged dependency","Ensure the repository hosting the artifact is declared (and mirrored) in the environment that builds","Refresh local metadata with mvn -U after adding a new repository so stale empty lists do not persist"],"tags":["maven","version-range","dependency-resolution","missing-artifact","metadata","legacy-compat"],"backgroundTag":"artifact-version-not-found","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}