我是靠谱客的博主 呆萌书本,最近开发中收集的这篇文章主要介绍maven 打包排除配置文件,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

如果你想通过pom.xml文件的配置实现的话,你可以这样
1、打jar包时过滤配置文件
<build>
<!-- 过滤配置文件 -->
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/*</exclude>
</excludes>
<filtering>true</filtering>
</resource>
</resources>
               <plugins>
                    ..............
                </plugins>
<build>

2、在plugins中添加插件
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <executions>
        <execution>
            <id>copy-resources</id>
            <phase>package</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
                <encoding>UTF-8</encoding>
                <outputDirectory>
                                                ${project.build.directory}
                                         </outputDirectory>   <!-- 表示把配置文件拷到和jar包同一个路径下 -->
                <resources>
                    <resource>
                        <directory>src/main/resources/</directory>
                    </resource>
                </resources>
            </configuration>
        </execution>
    </executions>
</plugin>

转载于:https://www.cnblogs.com/developer-ios/p/10083183.html

最后

以上就是呆萌书本为你收集整理的maven 打包排除配置文件的全部内容,希望文章能够帮你解决maven 打包排除配置文件所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(56)

评论列表共有 0 条评论

立即
投稿
返回
顶部