apache/maven · error · UnsupportedOperationException

Not implemented yet

Error message

Not implemented yet

What it means

DefaultNode.getRepository() is declared on the dependency Node API but is not implemented in Maven's default implementation - the method body is marked 'TODO: v4: implement' and unconditionally throws UnsupportedOperationException. Every call fails regardless of node state; no repository attribution data is wired up yet.

Source

Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultNode.java:76

    @Override
    public Dependency getDependency() {
        return node.getDependency() != null ? session.getDependency(node.getDependency()) : null;
    }

    @Override
    public List<Node> getChildren() {
        return new MappedList<>(node.getChildren(), n -> session.getNode(n, verbose));
    }

    @Override
    public List<RemoteRepository> getRemoteRepositories() {
        return new MappedList<>(node.getRepositories(), session::getRemoteRepository);
    }

    @Override
    public Optional<RemoteRepository> getRepository() {
        // TODO: v4: implement
        throw new UnsupportedOperationException("Not implemented yet");
    }

    /**
     * Returns a detailed string representation of this dependency node.
     * <p>
     * When verbose mode is disabled, returns the basic string representation in the format:
     * {@code groupId:artifactId:version[:scope]}
     * <p>
     * When verbose mode is enabled, additional details are included with the following format:
     * <ul>
     *   <li>For included dependencies: {@code groupId:artifactId:version[:scope] (details)}</li>
     *   <li>For omitted dependencies: {@code (groupId:artifactId:version[:scope] - details)}</li>
     * </ul>
     * Where details may include:
     * <ul>
     *   <li>Version management information (if the version was managed from a different version)</li>
     *   <li>Scope management information (if the scope was managed from a different scope)</li>
     *   <li>Scope updates (if the scope was changed during resolution)</li>

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Do not call Node.getRepository() on Maven 4 - the implementation is pending
  2. Use getRemoteRepositories() (implemented) to get the candidate repository set for the node
  3. Keep repository attribution in your own code by correlating resolved artifacts with the resolution request
  4. Track upstream Maven development for the v4 implementation before relying on this method

Example fix

// before
Optional<RemoteRepository> repo = node.getRepository(); // throws UnsupportedOperationException

// after
List<RemoteRepository> candidates = node.getRemoteRepositories();
Defensive patterns

Strategy: fallback

Type guard

static boolean repositorySupported(Node node) {
    // DefaultNode.getRepository() is a TODO in Maven 4 and always throws
    return !(node instanceof org.apache.maven.impl.DefaultNode);
}

Try / catch

try {
    node.getRepository();
} catch (UnsupportedOperationException e) {
    // Maven 4: not implemented; fall back to the candidate repository list
    List<RemoteRepository> candidates = node.getRemoteRepositories();
}

Prevention

When it happens

Trigger: Calling getRepository() on a Node obtained through the Maven 4 session API: session.getNode(...), dependency graph results, or elements of DefaultNode.getChildren().

Common situations: Plugins and extensions ported to the Maven 4 API that want to know which repository an artifact was resolved from; tooling that walks dependency graphs and assumes every interface method is functional.

Related errors


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/192c1366a2443527. Report an issue: GitHub.