force Maven to copy dependencies into target/lib

Michael picture Michael · Sep 19, 2008 · Viewed 265.8k times · Source

How do I get my project's runtime dependencies copied into the target/lib folder?

As it is right now, after mvn clean install the target folder contains only my project's jar, but none of the runtime dependencies.

Answer

Georgy Bolyuba picture Georgy Bolyuba · Jun 15, 2009

This works for me:

<project>
  ...
  <profiles>
    <profile>
      <id>qa</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <phase>install</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/lib</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>