Which formats can the dependencies:unpack-dependencies goal unpack?

Herosław Miraszewski

Which archive formats can dependencies:unpack-dependencies unpack? For instance, as far as I see it can't unpack RPM packages. Is there a list of formats it supports available somewhere? Is there some trick with which I can make maven unpack RPM package?

Tunaki

The Maven Dependency Plugin uses internally Plexus Archiver to archive and unarchive files. As of today, version 2.10 of the maven-dependency-plugin depends on version 2.9 of plexus-archiver.

Plexus components are configured with the help of a META-INF/plexus/components.xml file. In the case of the Dependency Plugin, you can see this file in the source code and it declares unarchiver for the following extensions: zip, jar, war, ear, swc, nar, esb, sar, car, par, rar. They all use the same ZipUnArchiver component, meaning they are all extracted as if they were ZIP files.

Plexus Archiver 2.9 also comes with its set of predefined unarchiver, and it adds: bzip2, gzip, tar, tgz, tar.gz, tbz2, tar.bz2 to the list. Latest version also adds snappy and xz files.


If you want to be able to unpack a custom extension, you will need to create a new project capable of unpacking it and register it as a Plexus component. For RPM packages, you can create a rpm-archiver Maven project and have the following inside META-INF/plexus/components.xml:

<component-set>
  <components>
    <component>
      <role>org.codehaus.plexus.archiver.UnArchiver</role>
      <role-hint>rpm</role-hint>
      <implementation>class.able.to.unpack.rpm.packages</implementation>
      <instantiation-strategy>per-lookup</instantiation-strategy>
    </component>
  </components>
</component-set>

where class.able.to.unpack.rpm.packages is the fully classified name of your custom class able to unpack RPM files. This class must implement the interface org.codehaus.plexus.archiver.UnArchiver, but to simplify, you can make this class inherit from org.codehaus.plexus.archiver.AbstractUnArchiver. All you need to do is then override the execute() and execute(path, outputDirectory) methods. The former needs to extract the file retrieved by getSourceFile() into the directory retrieved by getDestDirectory(), while the latter only extract the specified path inside the source file into the given outputDirectory.

After compiling and installing this new project, you can add it as a dependency to the maven-dependency-plugin:

<plugin>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.10</version>
    <!-- rest of your configuration -->
    <dependencies>
        <dependency>
            <groupId>my.archiver</groupId>
            <artifactId>rpm-archiver</artifactId>
            <version>0.0.1</version>
        </dependency>
    </dependencies>
</plugin>

This way, when the plugin runs, it will know how to unpack files having the rpm extension, and will use the class you configured in components.xml.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to unpack just the files from a sub-folder in maven-dependency-plugin with goal unpack-dependencies?

From Dev

Unpack wsdl schema from dependencies in Gradle

From Dev

Maven unpack-dependencies of a plugin dependency

From Java

Maven: Unpack-Dependencies ... and then forget about them

From Dev

Maven-dependency-plugin (unpack-dependencies) ignores configuration

From Dev

How can I unpack this?

From

maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e

From Dev

How to find which line causes unpack error

From Dev

Snakemake: dependencies which are not input

From Dev

Nest can't resolve dependencies of the service which imports JwtService

From Dev

How to write a maven plugin which can output the dependencies in a JSON format?

From Dev

How can I tell meson in which directories to look for dependencies?

From Dev

How can I Dockeries a python script which contains spark dependencies?

From Dev

Designing database for table which can has multiple optional column and dependencies

From Dev

Can you convert a table into a vararg without unpack?

From Dev

Can't unpack a flat list in a customized manner

From Dev

Can I unpack an F# list with no warnings?

From Dev

Can you unpack values in pony pattern matching?

From

Go: How can I "unpack" a struct?

From Dev

c protobuf data can‘t deserialize/unpack?

From Dev

how can unpack a list in list comprehension

From Android

Which dependencies are needed for using the Toolbar?

From Dev

Replace Incorrect Packages which are Dependencies

From Dev

Spark Can not find dependencies

From Dev

Composer can not install dependencies

From Dev

Can all dependencies be in devDependencies?

From Dev

Maven can not resolve dependencies

From

Can not download dependencies

From Dev

Jenkins can not resolve dependencies?

Related Related

  1. 1

    How to unpack just the files from a sub-folder in maven-dependency-plugin with goal unpack-dependencies?

  2. 2

    Unpack wsdl schema from dependencies in Gradle

  3. 3

    Maven unpack-dependencies of a plugin dependency

  4. 4

    Maven: Unpack-Dependencies ... and then forget about them

  5. 5

    Maven-dependency-plugin (unpack-dependencies) ignores configuration

  6. 6

    How can I unpack this?

  7. 7

    maven-dependency-plugin (goals "copy-dependencies", "unpack") is not supported by m2e

  8. 8

    How to find which line causes unpack error

  9. 9

    Snakemake: dependencies which are not input

  10. 10

    Nest can't resolve dependencies of the service which imports JwtService

  11. 11

    How to write a maven plugin which can output the dependencies in a JSON format?

  12. 12

    How can I tell meson in which directories to look for dependencies?

  13. 13

    How can I Dockeries a python script which contains spark dependencies?

  14. 14

    Designing database for table which can has multiple optional column and dependencies

  15. 15

    Can you convert a table into a vararg without unpack?

  16. 16

    Can't unpack a flat list in a customized manner

  17. 17

    Can I unpack an F# list with no warnings?

  18. 18

    Can you unpack values in pony pattern matching?

  19. 19

    Go: How can I "unpack" a struct?

  20. 20

    c protobuf data can‘t deserialize/unpack?

  21. 21

    how can unpack a list in list comprehension

  22. 22

    Which dependencies are needed for using the Toolbar?

  23. 23

    Replace Incorrect Packages which are Dependencies

  24. 24

    Spark Can not find dependencies

  25. 25

    Composer can not install dependencies

  26. 26

    Can all dependencies be in devDependencies?

  27. 27

    Maven can not resolve dependencies

  28. 28

    Can not download dependencies

  29. 29

    Jenkins can not resolve dependencies?

HotTag

Archive