Maven打包后为何文件大小改变了
程序员文章站
2022-07-13 09:57:26
...
项目中使用了X.509证书,用Maven打包后,测试时报错:
java.security.cert.CertificateException: Could not parse certificate: java.io.IOException: Invalid BER/DER data (too huge?)
查找了好一会儿原因,才发现证书文件确实变huge了。这是怎么导致的呢,因为resource使用了filter, maven更改了文件内容,解决方法如下:
<plugin> <artifactId>maven-resources-plugin</artifactId> <configuration> <nonFilteredFileExtensions> <nonFilteredFileExtension>cer</nonFilteredFileExtension> </nonFilteredFileExtensions> </configuration> </plugin>
以下摘自maven文档
Warning: Do not filter files with binary content like images! This will most likely result in corrupt output.
If you have both text files and binary files as resources it is recommended to have two separated folders. One folder src/main/resources (default) for the resources which are not filtered and another folder src/main/resources-filtered for the resources which are filtered.
上一篇: Linux zip小知识
下一篇: 3D游戏编程作业8