maven-dependency-plugin:unpack Error

PistolPete

I'm trying to extract some .exe files from a dependency jar file and put them under ${project.build.directory}/classes/.

But when I execute:

mvn clean compile dependency:unpack

I get:

Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.10:unpack (default-cli) on project simple: Either artifact or artifactItems is required -> [Help 1

I have verified that the dependencies are available in my local repository.

In my example pom below I've used junit as an example, but no matter which dependency I list, I get the same error.

pom.xml:

<build>
  <pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.10</version>
        <executions>
          <execution>
            <id>unpack</id>
            <phase>package</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <version>4.10</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
  <outputDirectory>${project.build.directory}/classes/externaltools</outputDirectory>                   
                  <includes>**/*.txt</includes>
                </artifactItem>
              </artifactItems>   
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </pluginManagement>
</build>
King Midas

The issue is due to you cannot use mvn clean compile dependency:unpack and <executions> tags together.

In documentation Maven Depdendency Plugin at the bottom part of the page you can read:

If you intend to configure this mojo for execution on the command line using: mvn dependency:unpack you must not put the configuration inside the executions tag. Your configuration should look like this:

<project>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.10</version>
        <configuration>
          <artifactItems>
            <artifactItem>
              <groupId>[ groupId ]</groupId>
              <artifactId>[ artifactId ]</artifactId>
              <version>[ version ]</version>
              <type>[ packaging ]</type>
              <classifier> [classifier - optional] </classifier>
              <overWrite>[ true or false ]</overWrite>
              <outputDirectory>[ output directory ]</outputDirectory>
              <destFileName>[ filename ]</destFileName>
              <includes>[ comma separated list of file filters ]</includes>
              <excludes>[ comma separated list of file filters ]</excludes>
            </artifactItem>
          </artifactItems>
          <!-- other configurations here -->
        </configuration>
      </plugin>
    </plugins>
  </build>
  [...]
</project>

I have tried removing the <execution> tags and works perfectly!

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 ignores type configuration

From Dev

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

From

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

From Dev

maven exclude plugin in dependency

From Dev

Maven resources plugin dependency

From Dev

Maven PlugIn Dependency Exception

From Dev

maven dependency plugin ignores dependency versions?

From Dev

Maven Plugin Dependency : class not found

From Dev

How to show dependency of a plugin in Maven?

From Dev

How to scan maven plugin dependency?

From Java

Maven dependency management for plugin dependencies

From Dev

maven: dependency compilation error

From Java

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

From Dev

How do I unpack AAR dependency classes in Maven?

From Dev

Maven build Error - Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy (copy)

From Dev

Aspectj maven plugin error

From Java

How to get the dependency tree in a Maven 3 plugin?

From Dev

Maven - Always download the latest version of dependency or plugin

From Java

How to exclude a direct dependency of a Maven Plugin

From Dev

Maven dependency plugin copy jar with dependencies

From Dev

maven-dependency-plugin ignores outputDirectory configuration

From Java

How to solve maven 2.6 resource plugin dependency?

From Dev

Maven-Dependency-Plugin: NoSuchElementException for Aether RepositorySystem

From Java

destFileName not used by maven-dependency-plugin?

From Dev

Maven Dependency Plugin: usedDependency vs. ignoredUnusedDeclaredDependencies

From Java

How to run maven plugin before dependency check

From Java

Maven plugin/extension to dynamically update dependency version

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 ignores type configuration

  4. 4

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

  5. 5

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

  6. 6

    maven exclude plugin in dependency

  7. 7

    Maven resources plugin dependency

  8. 8

    Maven PlugIn Dependency Exception

  9. 9

    maven dependency plugin ignores dependency versions?

  10. 10

    Maven Plugin Dependency : class not found

  11. 11

    How to show dependency of a plugin in Maven?

  12. 12

    How to scan maven plugin dependency?

  13. 13

    Maven dependency management for plugin dependencies

  14. 14

    maven: dependency compilation error

  15. 15

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

  16. 16

    How do I unpack AAR dependency classes in Maven?

  17. 17

    Maven build Error - Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:copy (copy)

  18. 18

    Aspectj maven plugin error

  19. 19

    How to get the dependency tree in a Maven 3 plugin?

  20. 20

    Maven - Always download the latest version of dependency or plugin

  21. 21

    How to exclude a direct dependency of a Maven Plugin

  22. 22

    Maven dependency plugin copy jar with dependencies

  23. 23

    maven-dependency-plugin ignores outputDirectory configuration

  24. 24

    How to solve maven 2.6 resource plugin dependency?

  25. 25

    Maven-Dependency-Plugin: NoSuchElementException for Aether RepositorySystem

  26. 26

    destFileName not used by maven-dependency-plugin?

  27. 27

    Maven Dependency Plugin: usedDependency vs. ignoredUnusedDeclaredDependencies

  28. 28

    How to run maven plugin before dependency check

  29. 29

    Maven plugin/extension to dynamically update dependency version

HotTag

Archive