Why does the file size change after Maven is packaged?

The X.509 certificate is used in the project. After packaging with Maven, the test reports an error:

java.security.cert.CertificateException: Could not parse certificate: java.io.IOException: Invalid BER/DER data (too huge?)

 

After looking for the reason for a while, I found that the certificate file has indeed become huge. How is this caused, because resource uses filter, maven changes the content of the file, the solution is as follows:

 

<plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <configuration>
        <nonFilteredFileExtensions>
            <nonFilteredFileExtension>cer</nonFilteredFileExtension>
        </nonFilteredFileExtensions>
    </configuration>
</plugin>

 

The following is taken from the maven documentation

 

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.

 

Binary filtering

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327016608&siteId=291194637