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

Frankenstein

How to unpack files from a sub-folder into a target folder?

Example:

My package includes ThisFolder and ThatFolder, I just want to unpack the folders and files from ThisFolder into the target directory, not the folder Thisfolder itself.

  <plugin>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
      <execution>
        <id>unpack_this</id>
        <goals>
          <goal>unpack-dependencies</goal>
        </goals>
        <phase>initialize</phase>
        <configuration>
          <includeArtifactIds>ZipFile</includeArtifactIds>
          <includes>ThisFolder/**</includes>
          <stripVersion>true</stripVersion>
          <outputDirectory>${project.build.directory}/dependency</outputDirectory>
        </configuration>
      </execution>
    </executions>
  </plugin>

In this example I'm almost there, but ThisFolder is included. If I try to use:

<excludes>ThisFolder</excludes>

it just doesn't work. Is there a solution to do this?

Gerold Broser

The Maven Dependency Plugin is made for dependencies, i.e. Java archives. The directory structure inside a Java archive is essential for the class files' package structure. So, it's easy to comprehed why the directories in your archive are considered by the plugin and cannot be suppressed.

The cleanest way I can think of at the moment is to copy the files afterwards. See Best practices for copying files with Maven.

(Another one is to use the Exec Maven Plugin with a zip.exe but that would introduce an external dependency.)

I'd prefer a solution with the Wagon Maven Plugin's copy goal as described in fnt's answer to the question linked above.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Maven unpack-dependencies of a plugin dependency

From Dev

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

From Dev

maven-dependency-plugin:unpack Error

From

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

From Dev

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

From Dev

Maven: How to unpack precise files from artifacts in the same output directory?

From Dev

maven-dependency-plugin:unpack ignores type configuration

From Dev

How do I unpack AAR dependency classes in Maven?

From Dev

How to use maven to unpack resource folder when .jar is ran

From Java

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

From Dev

Unpack wsdl schema from dependencies in Gradle

From Dev

How to unpack items from a List?

From Dev

How to unpack values from a file

From Java

Maven dependency management for plugin dependencies

From Dev

Maven how to invoke a plugin goal?

From Java

Difference between plugins and dependency in maven tool (unpack jar)

From Dev

Maven plugin dependencies couldn't resolve dependency from internal repo

From Java

How does maven knows which plugin needs to invoke from the goal?

From Dev

How to create a jar with Maven that includes dependencies in a separate folder for each dependency

From Dev

Maven: how to include module dependencies into general dependency-jars folder

From Dev

How does Maven Dependency Plugin determine used dependencies

From Dev

download .zip files with IDP: Download plugin for Inno Setup, and unpack them

From Dev

Fastest way to unpack bits (sub-byte) numbers from file

From Dev

How to unpack results from `Pool.map()`?

From Python

pandas: from how to unpack nested JSON as dataframe?

From Dev

How to unpack optional items from a tuple?

From Java

How to unpack a tuple from left to right?

From Dev

How to unpack a tuple right from out parameter?

From Dev

How to unpack values from a dataframe to xml

Related Related

  1. 1

    Maven unpack-dependencies of a plugin dependency

  2. 2

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

  3. 3

    maven-dependency-plugin:unpack Error

  4. 4

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

  5. 5

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

  6. 6

    Maven: How to unpack precise files from artifacts in the same output directory?

  7. 7

    maven-dependency-plugin:unpack ignores type configuration

  8. 8

    How do I unpack AAR dependency classes in Maven?

  9. 9

    How to use maven to unpack resource folder when .jar is ran

  10. 10

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

  11. 11

    Unpack wsdl schema from dependencies in Gradle

  12. 12

    How to unpack items from a List?

  13. 13

    How to unpack values from a file

  14. 14

    Maven dependency management for plugin dependencies

  15. 15

    Maven how to invoke a plugin goal?

  16. 16

    Difference between plugins and dependency in maven tool (unpack jar)

  17. 17

    Maven plugin dependencies couldn't resolve dependency from internal repo

  18. 18

    How does maven knows which plugin needs to invoke from the goal?

  19. 19

    How to create a jar with Maven that includes dependencies in a separate folder for each dependency

  20. 20

    Maven: how to include module dependencies into general dependency-jars folder

  21. 21

    How does Maven Dependency Plugin determine used dependencies

  22. 22

    download .zip files with IDP: Download plugin for Inno Setup, and unpack them

  23. 23

    Fastest way to unpack bits (sub-byte) numbers from file

  24. 24

    How to unpack results from `Pool.map()`?

  25. 25

    pandas: from how to unpack nested JSON as dataframe?

  26. 26

    How to unpack optional items from a tuple?

  27. 27

    How to unpack a tuple from left to right?

  28. 28

    How to unpack a tuple right from out parameter?

  29. 29

    How to unpack values from a dataframe to xml

HotTag

Archive