apache/maven · warning · IllegalStateException

Unable to lookup {}

Error message

Unable to lookup {}

What it means

The build runs offline (-o/--offline or offline=true in settings) and the mojo's descriptor declares requiresOnline=true, so Maven skips that execution entirely and logs this warning naming the goal. Anything the goal would have produced, such as generated sources or reports, is simply absent from this build.

Source

Thrown at compat/maven-compat/src/main/java/org/apache/maven/artifact/repository/DefaultArtifactRepositoryFactory.java:111

        factory.setGlobalUpdatePolicy(updatePolicy);
    }

    @Override
    public void setGlobalChecksumPolicy(String checksumPolicy) {
        factory.setGlobalChecksumPolicy(checksumPolicy);
    }

    private ArtifactRepository injectSession(ArtifactRepository repository, boolean mirrors) {
        RepositorySystemSession session = legacySupport.getRepositorySession();

        if (session != null && repository != null && !isLocalRepository(repository)) {
            List<ArtifactRepository> repositories = Arrays.asList(repository);

            RepositorySystem repositorySystem;
            try {
                repositorySystem = container.lookup(RepositorySystem.class);
            } catch (ComponentLookupException e) {
                throw new IllegalStateException("Unable to lookup " + RepositorySystem.class.getName());
            }

            if (mirrors) {
                repositorySystem.injectMirror(session, repositories);
            }

            repositorySystem.injectProxy(session, repositories);

            repositorySystem.injectAuthentication(session, repositories);
        }

        return repository;
    }

    private boolean isLocalRepository(ArtifactRepository repository) {
        // unfortunately, the API doesn't allow to tell a remote repo and the local repo apart...
        return "local".equals(repository.getId());
    }

View on GitHub (pinned to e4093d4e12)

Solutions

  1. Run that goal or module online, or drop -o for the whole build
  2. Warm the repository first: mvn dependency:go-offline (plus the plugin's own fetch goal if it has one), then go offline
  3. Deactivate the online-only plugin when building offline via a profile or skip flag
  4. Check with the plugin maintainer whether a cached or offline mode exists

Example fix

# before
mvn -o verify   # warns: Goal 'openapi:generate' requires online mode, skipping
# after: run online for this goal
mvn verify
Defensive patterns

Strategy: validation

Validate before calling

# warm everything the build downloads before switching to offline mode
mvn dependency:go-offline -Dmaven.repo.local=$REPO
mvn -o -Dmaven.repo.local=$REPO clean verify

Prevention

When it happens

Trigger: mvn -o combined with a plugin whose mojo is annotated @RequiresOnline: code generators downloading schemas, license checkers, or documentation mojos that must reach the network.

Common situations: Air-gapped CI and laptop builds; CI that pre-cached dependencies with dependency:go-offline but not the plugin's own runtime downloads.

Related errors


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