When attempting to copy runtime dependencies into the target/lib folder, Maven users may encounter a scenario where only the project's JAR is present after running mvn clean install.
To resolve this issue and ensure the inclusion of runtime dependencies, you can leverage the following approach:
The Maven Dependency Plugin provides a reliable solution for this task. By incorporating the following configuration, you can instruct Maven to copy the dependencies into the desired target/lib directory:
<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>
In the above configuration:
By integrating this configuration into your Maven project, you can successfully have your project's runtime dependencies copied into the target/lib folder after performing a mvn clean install.
The above is the detailed content of How to Copy Runtime Dependencies into Target/lib Using Maven?. For more information, please follow other related articles on the PHP Chinese website!