{"record":{"id":"3d799dae761aa552","repo":"apache/maven","slug":"error-resolving-version-for-plugin-groupid-a","errorCode":null,"errorMessage":"Error resolving version for plugin '${groupId}:${artifactId}' from the repositories ${repositories}: ${baseMessage}","messagePattern":"Error resolving version for plugin '(.+?):(.+?)' from the repositories (.+?): (.+?)","errorType":"exception","errorClass":"PluginManagerException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java","lineNumber":965,"sourceCode":"            project.setContextValue(KEY_EXTENSIONS_REALMS, pluginRealms);\n        }\n\n        final String pluginKey = plugin.getId();\n\n        ExtensionRealmCache.CacheRecord extensionRecord = pluginRealms.get(pluginKey);\n        if (extensionRecord != null) {\n            return extensionRecord;\n        }\n\n        final List<RemoteRepository> repositories = project.getRemotePluginRepositories();\n\n        // resolve plugin version as necessary\n        if (plugin.getVersion() == null) {\n            PluginVersionRequest versionRequest = new DefaultPluginVersionRequest(plugin, session, repositories);\n            try {\n                plugin.setVersion(pluginVersionResolver.resolve(versionRequest).getVersion());\n            } catch (PluginVersionResolutionException e) {\n                throw new PluginManagerException(plugin, e.getMessage(), e);\n            }\n        }\n\n        // TODO: store plugin version\n\n        // resolve plugin artifacts\n        List<Artifact> artifacts;\n        PluginArtifactsCache.Key cacheKey = pluginArtifactsCache.createKey(plugin, null, repositories, session);\n        PluginArtifactsCache.CacheRecord recordArtifacts;\n        try {\n            recordArtifacts = pluginArtifactsCache.get(cacheKey);\n        } catch (PluginResolutionException e) {\n            throw new PluginManagerException(plugin, e.getMessage(), e);\n        }\n        if (recordArtifacts != null) {\n            artifacts = recordArtifacts.getArtifacts();\n        } else {\n            try {","sourceCodeStart":947,"sourceCodeEnd":983,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java#L947-L983","documentation":"The POM declares the plugin without a <version>, so Maven had to resolve one from repository metadata, and the version resolver failed — wrapped here as PluginManagerException carrying the PluginVersionResolutionException message (plugin coordinates, repository list, and the concrete reason). Common underlying reasons: no maven-metadata.xml for that plugin group in any reachable repository, metadata unreadable/404, or the plugin only has SNAPSHOT metadata while a release version was requested.","triggerScenarios":"Version-less <plugin> entry plus: plugin group not present in the configured pluginRepositories (or not proxied by the mirror), missing/invalid maven-metadata.xml for the plugin, running with -o against a cache without prior metadata, or a typo in groupId making resolution look in the wrong path.","commonSituations":"First use of an internal plugin whose group was never deployed to the repo manager; corporate mirrors blocking external plugin groups; prefix resolution found the plugin (via pluginGroups) but version metadata is absent; air-gapped environments with incomplete proxies.","solutions":["Pin an explicit <version> on the plugin — the immediate fix and long-standing best practice.","Verify the plugin's maven-metadata.xml exists in a configured repository (browse or curl the group path).","Add the plugin's groupId to <pluginGroups> or the plugin's repository to <pluginRepositories> if it lives outside the defaults.","Check the groupId/artifactId spelling — a typo resolves metadata in a nonexistent path.","If offline (-o) was used, run once online so metadata is cached, or pre-seed the cache."],"exampleFix":"// before: no version, resolver must consult metadata (and fails when it is missing)\n<plugin>\n  <groupId>org.example</groupId>\n  <artifactId>example-maven-plugin</artifactId>\n</plugin>\n\n// after: always pin an explicit version\n<plugin>\n  <groupId>org.example</groupId>\n  <artifactId>example-maven-plugin</artifactId>\n  <version>1.2.0</version>\n</plugin>","handlingStrategy":"validation","validationCode":"# fail fast in CI when any plugin lacks an explicit version (the precondition for this error)\npython3 - <<'EOF'\nimport xml.etree.ElementTree as ET\nns = {'m': 'http://maven.apache.org/POM/4.0.0'}\nt = ET.parse('pom.xml')\nbad = []\nfor p in t.findall('.//m:plugin', ns):\n    if p.find('m:version', ns) is None:\n        bad.append(p.find('m:artifactId', ns).text)\nassert not bad, 'plugins without pinned version: ' + ', '.join(bad)\nEOF\n\n# and verify the plugin's metadata is reachable\ncurl -fsSI https://repo.example.com/org/example/example-maven-plugin/maven-metadata.xml","typeGuard":null,"tryCatchPattern":"// embedder: distinguish version-resolution failure from other plugin manager problems\ntry {\n    setupPlugin(project, plugin, session);\n} catch (PluginManagerException e) {\n    if (e.getCause() instanceof PluginVersionResolutionException pvre) {\n        log.error('pin an explicit <version> for this plugin; metadata reason: {}', pvre.getMessage());\n    }\n    throw e;\n}","preventionTips":["Always pin plugin versions — with a version set, this code path is never exercised.","Add the maven-enforcer-plugin requirePluginVersions rule to enforce pinning repo-wide.","Make sure internal plugin groups are deployed to repositories listed in pluginRepositories.","Keep groupId spellings for internal plugins in a snippet library to avoid metadata lookups in wrong paths."],"tags":["maven","plugin","version-resolution","metadata","repositories"],"backgroundTag":"plugin-version-unresolvable","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}