apache/maven · error · IllegalArgumentException
no remote repositories provided
Error message
no remote repositories provided
What it means
AbstractSession.getRepositories(repositories, resolverRepositories) merges the request-scoped and session-scoped remote repository lists before resolution. If both are null it throws IllegalArgumentException because dependency or artifact resolution has no repositories to query. It is the guard behind Maven API resolution calls (e.g. DependencyResolverRequest, ArtifactResolverRequest) that end up with an empty effective repository list.
Source
Thrown at impl/maven-impl/src/main/java/org/apache/maven/impl/AbstractSession.java:325
throw new UnsupportedOperationException("Not implemented yet");
}
}
@Override
public List<org.eclipse.aether.graph.Dependency> toDependencies(
Collection<DependencyCoordinates> dependencies, boolean managed) {
return dependencies == null ? null : map(dependencies, d -> toDependency(d, managed));
}
static List<RemoteRepository> getRepositories(
List<RemoteRepository> repositories,
List<org.eclipse.aether.repository.RemoteRepository> resolverRepositories) {
if (repositories != null) {
return repositories;
} else if (resolverRepositories != null) {
return map(resolverRepositories, DefaultRemoteRepository::new);
} else {
throw new IllegalArgumentException("no remote repositories provided");
}
}
@Nonnull
@Override
public List<RemoteRepository> getRemoteRepositories() {
return Collections.unmodifiableList(repositories);
}
@Nonnull
@Override
public SessionData getData() {
org.eclipse.aether.SessionData data = session.getData();
return new SessionData() {
@Override
public <T> void set(@Nonnull Key<T> key, @Nullable T value) {
data.set(key, value);
}View on GitHub (pinned to e4093d4e12)
Solutions
- Set repositories on the request: DependencyResolverRequest.builder().setRepositories(session.getRemoteRepositories()) or an explicit list
- Create the session with at least one remote repository (e.g. central) via the session factory / SessionBuilder
- If only local resolution is intended, check the local repository first and skip the remote resolution path instead of calling resolve with no repositories
Example fix
// before
DependencyResolverRequest req = DependencyResolverRequest.builder()
.session(session)
.request(DependencyRequest...) // no setRepositories
.build();
session.getService(DependencyResolver.class).resolve(req); // throws: no repositories
// after
DependencyResolverRequest req = DependencyResolverRequest.builder()
.session(session)
.request(DependencyRequest...)
.setRepositories(session.getRemoteRepositories())
.build(); Defensive patterns
Strategy: validation
Validate before calling
List<RemoteRepository> repos = request.repositories() != null
? request.repositories()
: session.getRemoteRepositories();
if (repos == null || repos.isEmpty()) {
throw new IllegalArgumentException('No remote repositories: pass repositories in the request or configure the session');
} Prevention
- Always set repositories on resolution requests instead of relying on implicit session state
- When building a session programmatically, add at least central
- Log the effective repository list before resolving in embedded scenarios
When it happens
Trigger: Calling session.getService(DependencyResolver.class).resolve(...) or ArtifactResolver with a request whose setRepositories(...) is null/omitted while the session itself was created with no remote repositories (e.g. a minimal/standalone session or one built with an empty repository list).
Common situations: Embedding Maven Resolver in standalone tools and forgetting to add central; building a Session via a factory without settings.xml repositories; passing request.repositories as null deliberately for 'session default' but the session default is empty; tests with a session wired to only a local repository.
Related errors
- Unable to get dependency information: " + e.getMessage()
- Unable to get dependency information for " + artifact.getId(
- Unable to resolve artifacts:
- Only fully-qualified sets allowed in multiple set scenario:
- Single version must be surrounded by []: {}
AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21).
Data as JSON: /api/errors/812ca62e073a02b5.
Report an issue: GitHub.