首先 给出在我们一个打jar包的项目的处理结果,maven打包的时候发现出现了缓存,
调整pom文件发现没有用,可以在clean install package的时候 修改下本次打包的名字比如加个11
什么的 ,clean install package去掉个clean之类 去除缓存的影响

给出我们一个pom的解决方案
<!-- add by flyer 0614 -->
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<!--注意从编译结果目录开始算目录结构-->
<exclude>/config/application*.properties</exclude>
<exclude>/logback.xml</exclude>
</excludes>
</configuration>
</plugin>
<exclude>/config/application*.properties</exclude><exclude>/logback.xml</exclude> 这是要排除的文件
以下
转载: https://blog.youkuaiyun.com/peihexian/article/details/78697251
maven-jar-plugin 打包jar简单吧,是个人都会用,但是这玩意有个毛病,会把所有编译结果都打到jar包里面去,如果是多模块的工程,有时候会想把某些模块的功能打成jar包给其他模块使用,但是这些模块特有的xml配置文件和properties文件等就没有必要打包进去了,甚至打包进去的话会有问题的,如spring配置参数文件会被反复加载等,具体怎么排除呢?
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>3.0.2</version> <executions> <execution> <phase>package</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> <configuration> <excludes> <!--注意这玩意从编译结果目录开始算目录结构--> <exclude>/*.properties</exclude> <exclude>/*.xml</exclude> </excludes> </configuration> </plugin>
最最最最坑人的是exclude的目录不是src下面的,是以编译结果classes为根目录计算的,所以想怎么排除就知道了吧?就这么个知识点折腾了我好几天啊!