Skip to content

Archivers created without a container fail in addArchivedFileSet #499

Closed

Description

@slachiewicz

An archiver obtained from ServiceLoaderArchiverManager, or created with its constructor, fails as soon as an archived file set is added:

java.lang.NullPointerException: Cannot invoke "javax.inject.Provider.get()" because "this.archiverManagerProvider" is null
    at org.codehaus.plexus.archiver.AbstractArchiver.asResourceCollection(AbstractArchiver.java:589)

AbstractArchiver.archiverManagerProvider is set only by JSR-330 injection, so outside a container nothing ever sets it, and asResourceCollection dereferences it unconditionally. ServiceLoaderArchiverManager (#444) exists for exactly the no-container case, so the archivers it hands out cannot unpack anything.

Reproduce on master:

Archiver archiver = new ServiceLoaderArchiverManager().getArchiver("zip");
archiver.setDestFile(new File("out.zip"));
archiver.addArchivedFileSet(DefaultArchivedFileSet.archivedFileSet(new File("src/test/resources/test.zip")));

Found while porting maven-assembly-plugin to the Maven 4 API (apache/maven#13302), where ServiceLoaderArchiverManager is the only way to get archivers.

Activity

  1. added
    bug
    on Sep 30, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions