Extract the jar that the maven project depends on

Sometimes it is necessary for maven to extract all the dependent jar files of the current project to a specified folder, which can be achieved by using maven-dependency-plugin.
1. Add the following content in pom.xml:

<plugin> 
<artifactId>maven-dependency-plugin</artifactId> 
<configuration> 
<outputDirectory>${project.build.directory}/lib</outputDirectory> 
<excludeTransitive>false</excludeTransitive> 
<stripVersion>true</stripVersion> 
</configuration> 
</plugin> 

*Among them, ${project.build.directory} is a maven variable, which means the target directory. If you don't write it, the lib directory will be created in the root directory.
*ExcludeTransitive, indicates whether the indirect dependent packages are not included;
*stripVersion indicates that the copied jar file removes the version information.

2. Execute mvn dependency:copy-dependencies and
all dependent jars will be extracted to the lib directory

Write picture description here

Guess you like

Origin blog.csdn.net/ke_weiquan/article/details/51896320