{"record":{"id":"8e44c5bda24800e2","repo":"apache/maven","slug":"cannot-find-conflict-resolver-of-type-type","errorCode":null,"errorMessage":"Cannot find conflict resolver of type: \" + type","messagePattern":"Cannot find conflict resolver of type: \" \\+ type","errorType":"exception","errorClass":"ConflictResolverNotFoundException","httpStatus":null,"severity":"error","filePath":"compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java","lineNumber":61,"sourceCode":"\n    /**\n     * The plexus container used to obtain instances from.\n     */\n    @Inject\n    private PlexusContainer container;\n\n    // ConflictResolverFactory methods ----------------------------------------\n\n    /*\n     * @see org.apache.maven.artifact.resolver.conflict.ConflictResolverFactory#getConflictResolver(java.lang.String)\n     */\n\n    @Override\n    public ConflictResolver getConflictResolver(String type) throws ConflictResolverNotFoundException {\n        try {\n            return (ConflictResolver) container.lookup(ConflictResolver.ROLE, type);\n        } catch (ComponentLookupException exception) {\n            throw new ConflictResolverNotFoundException(\"Cannot find conflict resolver of type: \" + type);\n        }\n    }\n\n    // Contextualizable methods -----------------------------------------------\n\n    /*\n     * @see org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable#contextualize(org.codehaus.plexus.context.Context)\n     */\n\n    @Override\n    public void contextualize(Context context) throws ContextException {\n        container = (PlexusContainer) context.get(PlexusConstants.PLEXUS_KEY);\n    }\n}\n","sourceCodeStart":43,"sourceCodeEnd":76,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/compat/maven-compat/src/main/java/org/apache/maven/repository/legacy/resolver/conflict/DefaultConflictResolverFactory.java#L43-L76","documentation":"DefaultConflictResolverFactory.getConflictResolver(type) performs a Plexus component lookup of the ConflictResolver role with the given hint. When the lookup throws ComponentLookupException (no component registered under that hint), it is converted to ConflictResolverNotFoundException('Cannot find conflict resolver of type: <type>'). The registered legacy implementations are 'nearest', 'newest', 'oldest' and 'farthest'.","triggerScenarios":"Passing a conflict resolver type string that has no registered component — a typo ('newest ' with whitespace, 'Nearest' wrong case, 'nearest-version') or a custom type whose implementation class was removed from the classpath. Reached through the legacy resolver when it asks the factory for the configured conflict resolution strategy.","commonSituations":"Porting Maven 2-era configuration or documentation that references a conflict resolver name that no longer exists; custom Plexus component not discovered because its JAR lacks proper metadata; classpath pruning (maven-shade/assembly) stripping the component descriptor.","solutions":["Use one of the built-in type hints: \"nearest\" (Maven default), \"newest\", \"oldest\", or \"farthest\" — exact lowercase spelling","If a custom ConflictResolver is intended, ensure it is a proper Plexus/JSR-330 component with a component descriptor on the runtime classpath","Clear or correct the property/configuration that carries the resolver type (it was commonly injected via system property in Maven 2 forks)"],"exampleFix":"// before\nConflictResolver r = factory.getConflictResolver(\"Nearest\");\n\n// after\nConflictResolver r = factory.getConflictResolver(\"nearest\");","handlingStrategy":"validation","validationCode":"private static final Set<String> KNOWN_CONFLICT_RESOLVERS =\n    Set.of(\"nearest\", \"newest\", \"oldest\", \"farthest\");\n\nString normalizeConflictResolverType(String type) {\n    String t = type == null ? \"nearest\" : type.trim().toLowerCase(Locale.ROOT);\n    if (!KNOWN_CONFLICT_RESOLVERS.contains(t)) {\n        throw new IllegalArgumentException(\n            \"Unknown conflict resolver '\" + type + \"'; expected one of \" + KNOWN_CONFLICT_RESOLVERS);\n    }\n    return t;\n}","typeGuard":null,"tryCatchPattern":"try {\n    ConflictResolver resolver = factory.getConflictResolver(type);\n} catch (ConflictResolverNotFoundException e) {\n    log.warn(\"Unknown conflict resolver type '{}'; using 'nearest'\", type);\n    resolver = factory.getConflictResolver(\"nearest\");\n}","preventionTips":["Source the resolver type from an enum or constant instead of free-form configuration strings","Trim/case-normalize external input before passing it to the factory","If using a custom resolver, include an integration test that performs the lookup so a missing component fails the build, not production"],"tags":["maven","conflict-resolution","plexus","component-lookup","legacy-compat"],"backgroundTag":"unknown-strategy-name","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}