GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Maven 4: MavenSession.lookup() NPE — PlexusContainer not injected for plugins using deprecated API · Issue #12986 · apache/maven

Maven 4: MavenSession.lookup() NPE — PlexusContainer not injected for plugins using deprecated API #12986

New issue
Copy link
New issue
Copy link
Closed
Closed
Maven 4: MavenSession.lookup() NPE — PlexusContainer not injected for plugins using deprecated API#12986
Copy link
Milestone
4.0.0-rc-7

Description

@gnodet
gnodet
opened on Sep 1, 2026
Issue body actions

Problem

Plugins that use the deprecated PlexusContainer injection via MavenSession.lookup() get a NullPointerException in Maven 4 because this.container is null:

[ERROR] Failed to execute goal org.codehaus.groovy.maven:gmaven-plugin:1.0:execute
  on project manual: java.lang.NullPointerException:
  Cannot invoke "org.codehaus.plexus.PlexusContainer.lookup(String)"
  because "this.container" is null

Stack trace:

at org.apache.maven.execution.MavenSession.lookup(MavenSession.java:477)
at org.codehaus.groovy.maven.plugin.execute.ExpressionEvaluatorImpl.lookupPathTranslator(...)
at org.codehaus.groovy.maven.plugin.execute.ExpressionEvaluatorImpl.<init>(...)

Affected project

  • servicemix — uses gmaven-plugin:1.0 which calls MavenSession.lookup() internally

Analysis

MavenSession.container was deprecated but still used by several plugins. In Maven 4, it appears the field is no longer populated. While the API is deprecated, the result is a hard NPE rather than a graceful deprecation warning.

Expected behavior

Either:

  1. Continue injecting the PlexusContainer into MavenSession for backward compatibility (with a deprecation warning)
  2. Or throw a descriptive exception (e.g., UnsupportedOperationException("PlexusContainer injection was removed in Maven 4. Use JSR 330 injection instead.")) rather than an NPE

Context

Data from maven4-testing run #13307 testing maven-4.0.x against all Apache projects.

Activity

  1. gnodet
    added this to the 4.0.0-rc-7 milestone on Sep 1, 2026
  2. gnodet
    added a commit that references this issue on Sep 2, 2026

    Fix #12986: Throw descriptive UnsupportedOperationException instead o…

    This issue will close once commit 42ef67c is merged into the 'master' branch.
    42ef67c
  3. gnodet
    closed this as completedin 2f42cddon Sep 2, 2026
  4. pull
    added a commit that references this issue on Sep 2, 2026

    Fix apache#12986: Throw descriptive UnsupportedOperationException ins…

    This issue will close once commit 2f42cdd is merged into the 'master' branch.
    2f42cdd
  5. gnodet
    added a commit that references this issue on Sep 2, 2026

    Fix #12986: Throw descriptive UnsupportedOperationException instead o…

    This issue will close once commit 20c5983 is merged into the 'master' branch.
    20c5983
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      • 4.0.0-rc-7

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.