Last active
March 21, 2018 07:40
-
-
Save RebieKong/9bbeefd9fd6fb91227047adfa48f1a4d to your computer and use it in GitHub Desktop.
maven打包时依赖包的处理方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 打包时将依赖放到target/lib目录下 --> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-dependency-plugin</artifactId> | |
<executions> | |
<execution> | |
<id>copy-dependencies</id> | |
<phase>prepare-package</phase> | |
<goals> | |
<goal>copy-dependencies</goal> | |
</goals> | |
<configuration> | |
<outputDirectory>${project.build.directory}/lib</outputDirectory> | |
<overWriteReleases>false</overWriteReleases> | |
<overWriteSnapshots>false</overWriteSnapshots> | |
<overWriteIfNewer>true</overWriteIfNewer> | |
<includeScope>runtime</includeScope> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<!-- assembly时打成一个包含所有依赖的jar --> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-assembly-plugin</artifactId> | |
<configuration> | |
<descriptorRefs> | |
<descriptorRef>jar-with-dependencies</descriptorRef> | |
</descriptorRefs> | |
</configuration> | |
</plugin>> | |
<!-- package时打成一个包含所有依赖的jar --> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-assembly-plugin</artifactId> | |
<executions> | |
<execution> | |
<id>make-assembly</id> | |
<phase>prepare-package</phase> | |
<goals> | |
<goal>single</goal> | |
</goals> | |
</execution> | |
</executions> | |
<configuration> | |
<descriptorRefs> | |
<descriptorRef>jar-with-dependencies</descriptorRef> | |
</descriptorRefs> | |
</configuration> | |
</plugin> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment