zoukankan      html  css  js  c++  java
  • 【maven】Maven打包后为何文件大小改变了

    项目中使用了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>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.5</version>
        <configuration>
            <encoding>UTF-8</encoding>
            <nonFilteredFileExtensions>
                <nonFilteredFileExtension>pfx</nonFilteredFileExtension>
                <nonFilteredFileExtension>crt</nonFilteredFileExtension>
                <nonFilteredFileExtension>cer</nonFilteredFileExtension>
                <nonFilteredFileExtension>key</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.

  • 相关阅读:
    socket (一)
    yield生成器及字符串的格式化
    python模块(json和pickle模块)
    python标准模块(time、datetime及hashlib模块)
    python标准模块(os及sys模块)
    python模块简介
    python --> 正则表达式
    python --> 递归 以及装饰器
    python基础知识(四)
    python基础知识(三)
  • 原文地址:https://www.cnblogs.com/shangxiaofei/p/8987653.html
Copyright © 2011-2022 走看看