I need to essentially accomplish the following:
- Build my library into a JAR. (Easy, already done.)
- Copy my library's dependencies to a local folder, including the main project JAR, excluding dependencies marked as
provided
.
I can't seem to get the second part finished. Is there a better way to do this than how I'm doing it below? I'm essentially deploying these JARs to a lib directory on a server. Unfortunately, the code below includes all JARs, even provided
ones, but doesn't include the project output JAR. Should I be using a different plugin for this?
<?xml version="1.0"?>
<project>
...
<dependencies>
<dependency>
<groupId>com.provided</groupId>
<artifactId>provided-lib</artifactId>
<version>1.2.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>/hello</outputDirectory>
<excludeTransitive>true</excludeTransitive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>