{"record":{"id":"6bd92e84fe649527","repo":"apache/maven","slug":"unable-to-find-field-resolution-getfield-an","errorCode":null,"errorMessage":"Unable to find field '${resolution.getField()}' annotated with @Resolution","messagePattern":"Unable to find field '(.+?)' annotated with @Resolution","errorType":"exception","errorClass":"PluginConfigurationException","httpStatus":null,"severity":"error","filePath":"impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java","lineNumber":617,"sourceCode":"                mojo,\n                mojoExecution.getExecutionId(),\n                mojoDescriptor,\n                pluginRealm,\n                pomConfiguration,\n                expressionEvaluator);\n\n        for (Resolution resolution : mojoDescriptor.getMojoDescriptorV4().getResolutions()) {\n            Field field = null;\n            for (Class<?> clazz = mojo.getClass(); clazz != Object.class; clazz = clazz.getSuperclass()) {\n                try {\n                    field = clazz.getDeclaredField(resolution.getField());\n                    break;\n                } catch (NoSuchFieldException e) {\n                    // continue\n                }\n            }\n            if (field == null) {\n                throw new PluginConfigurationException(\n                        pluginDescriptor,\n                        \"Unable to find field '\" + resolution.getField() + \"' annotated with @Resolution\");\n            }\n            field.setAccessible(true);\n            String pathScope = resolution.getPathScope();\n            Object result = null;\n            if (pathScope != null && !pathScope.isEmpty()) {\n                // resolution\n                PathScope ps = sessionV4.getService(PathScopeRegistry.class).require(pathScope);\n                DependencyResolverResult res =\n                        sessionV4.getService(DependencyResolver.class).resolve(sessionV4, project, ps);\n                if (field.getType() == DependencyResolverResult.class) {\n                    result = res;\n                } else if (field.getType() == Node.class) {\n                    result = res.getRoot();\n                } else if (field.getType() == List.class && field.getGenericType() instanceof ParameterizedType pt) {\n                    Type t = pt.getActualTypeArguments()[0];\n                    if (t == Node.class) {","sourceCodeStart":599,"sourceCodeEnd":635,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java#L599-L635","documentation":"The Maven-4 mojo descriptor records a @Resolution-annotated field by name, but no declared field with that name exists in the mojo class or any superclass - descriptor and bytecode disagree. Because the resolution cannot be injected into a nonexistent field, Maven throws PluginConfigurationException naming the missing field.","triggerScenarios":"plugin.xml was generated from an older source of the mojo class (field renamed or removed since); a stale descriptor shipped by an incremental build; a descriptor hand-edited or produced by mismatched tooling.","commonSituations":"Plugin development with stale target/classes; renaming annotated fields without a clean rebuild; CI caches publishing plugins built from partial sources.","solutions":["Clean-rebuild and reinstall the plugin: mvn clean install regenerates plugin.xml from the current annotations.","Verify that every <resolution field=\"...\"> in target/classes/META-INF/maven/plugin.xml matches a real field in the source.","Keep maven-plugin-plugin aligned with the maven-plugin-annotations version used to compile.","For a third-party plugin, report it or upgrade - the published descriptor is stale."],"exampleFix":"// before: descriptor says field=\"deps\" but the class now declares\n@Resolution(DependencyScope.PROJECT)\nprivate DependencyResolverResult resolutionResult;\n// after: rename the field back to \"deps\", or regenerate the descriptor\nmvn clean install -pl my-plugin","handlingStrategy":"validation","validationCode":"mvn clean install -pl my-plugin\n# descriptor fields must match every field carrying @Resolution in the sources:\ngrep -oE '<resolution field=\"[^\"]+\"' my-plugin/target/classes/META-INF/maven/plugin.xml","typeGuard":null,"tryCatchPattern":"try {\n    mojo = pluginManager.getConfiguredMojo(mojoInterface, session, mojoExecution);\n} catch (PluginConfigurationException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"annotated with @Resolution\")) {\n        // stale descriptor vs class: instruct users to take the freshly built plugin version\n    }\n    throw e;\n}","preventionTips":["Always clean-build plugins before installing or publishing","Rename annotated fields and regenerate the descriptor in the same change","Keep maven-plugin-plugin in sync with the annotations version"],"tags":["maven","maven4","descriptor","annotations","stale-build"],"backgroundTag":"stale-plugin-descriptor","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}