Reputation: 7665
I am trying to have all my dependencies side by side with my main jar in lib folder
I have added the maven-dependency-plugin configuration to the pom specifying the outputDirectory
the build is successful when running
mvn clean package
Main jar is compiled and built, but I don't see the dependencies copied, what am I doing wrong?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
maven version
C:\Users\user56>mvn -v
Apache Maven 3.5.0 (REMOVED; 2017-04-03T15:39:06-04:00)
Maven home: c:\apache-maven-3.5.0\bin\..
Java version: 1.8.0_144, vendor: Oracle Corporation
Upvotes: 1
Views: 87
Reputation: 4711
I tried your configuration with maven 3.5 and maven-dependency-plugin 2.10, and it works. The dependencies are copied to <project>/target/lib
. Please check your maven version (mvn -v
) and the version of the plugin and upgrade if you're using older versions.
[INFO] --- maven-dependency-plugin:2.10:copy-dependencies (copy-dependencies) @ myproject ---
[INFO] Copying guava-18.0.jar to /Users/user/git/myproject/target/lib/guava-18.0.jar
Upvotes: 1