我是靠谱客的博主 呆萌书本,这篇文章主要介绍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内容请搜索靠谱客的其他文章。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部