0

How to copy all the provided Maven dependency in a "provided-libs" directory?

I'm looking into this link and I find that there is a way to copy dependencies. But I want to copy into "provided-libs" only the dependencies whose scope is "provided".

Thank you so much!

1 Answers1

0

Try using the includeScope parameter inside the configuration of the plugin:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.8</version>
    <executions>
        <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
                <goal>copy-dependencies</goal>
            </goals>
            <configuration>
                <includeScope>provided</includeScope>
                <outputDirectory>provided-libs</outputDirectory>                        
            </configuration>
        </execution>
    </executions>
</plugin>
M A
  • 71,713
  • 13
  • 134
  • 174
  • Yes, thanks. I've just found this solution. I was about to avoid such solution because of the error marker that the goal **copy-dependencies** is not supported by m2e. But here I've had my solution : http://stackoverflow.com/questions/8706017/maven-dependency-plugin-goals-copy-dependencies-unpack-is-not-supported-b –  Jun 19 '14 at 14:21