Question:
After executing mvn clean install, the target folder only includes the project's JAR, without any runtime dependencies. How can I have these dependencies copied into the target/lib folder?
Answer:
To copy dependencies to target/lib, you can use the following Maven configuration:
<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>
By adding this configuration, the maven-dependency-plugin will copy the JAR dependencies during the install phase, placing them in the specified outputDirectory.
The above is the detailed content of How to Copy Maven Dependencies to target/lib After `mvn clean install`?. For more information, please follow other related articles on the PHP Chinese website!