Skip to content

Instantly share code, notes, and snippets.

@programsimon
Last active February 20, 2023 06:16
Show Gist options
  • Select an option

  • Save programsimon/744f1767371d8cdd61b0b76a5ac9d018 to your computer and use it in GitHub Desktop.

Select an option

Save programsimon/744f1767371d8cdd61b0b76a5ac9d018 to your computer and use it in GitHub Desktop.
[Maven打包插件不打包依赖] 在不需要将所有依赖打在包中时使用,jar包中仅保存开发代码部分。#java #maven #jar
<!-- 打包时排除yml文件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*.yml</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment