选择Maven包中特定文件的编码方式

huangapple go评论68阅读模式
英文:

Choose encoding for a specific file with Maven package

问题

我想使用Maven创建一个包,其中包含一个.jks证书文件,该文件应该使用cp1252(ANSI)编码。

我有一个包含配置文件的装配体

<fileSet>
    <outputDirectory>compjava/properties</outputDirectory>
    <directory>${basedir}/src/config</directory>
    <filtered>true</filtered>
    <includes>
        <include>truststore.jks</include>
    </includes>
</fileSet>

而在我的pom属性中,我定义了

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

我的输入证书文件是ANSI编码,但在包中却是UTF-8。为什么?

英文:

I would like create a package with Maven which contains a .jks certificate and this file should have a cp1252 (ANSI) encoding.

I have an assembly with my configuration files

         &lt;fileSet&gt;
			&lt;outputDirectory&gt;compjava/properties&lt;/outputDirectory&gt;
			&lt;directory&gt;${basedir}/src/config&lt;/directory&gt;
			&lt;filtered&gt;true&lt;/filtered&gt;
			&lt;includes&gt;
				&lt;include&gt;truststore.jks&lt;/include&gt;
			&lt;/includes&gt;
		&lt;/fileSet&gt;

And in my pom properties, I defined

&lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
&lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;

My input certificate file is ANSI-encoded but in the package, it is UTF-8. Why?

答案1

得分: 0

我终于找到了答案...

在我的汇编中,有必要为我的证书文件放置 &lt;filtered&gt;false&lt;filtered&gt;

       &lt;fileSet&gt;
			&lt;outputDirectory&gt;compjava/properties&lt;/outputDirectory&gt;
			&lt;directory&gt;${basedir}/src/config&lt;/directory&gt;
			&lt;filtered&gt;false&lt;/filtered&gt;
			&lt;excludes&gt;
				&lt;exclude&gt;*.properties&lt;/exclude&gt;
				&lt;exclude&gt;*.template&lt;/exclude&gt;
			&lt;/excludes&gt;
		&lt;/fileSet&gt;
英文:

I finally found the answer...

In my assembly, it is necessary to put &lt;filtered&gt;false&lt;filtered&gt; for my certificate file.

       &lt;fileSet&gt;
			&lt;outputDirectory&gt;compjava/properties&lt;/outputDirectory&gt;
			&lt;directory&gt;${basedir}/src/config&lt;/directory&gt;
			&lt;filtered&gt;false&lt;/filtered&gt;
			&lt;excludes&gt;
				&lt;exclude&gt;*.properties&lt;/exclude&gt;
				&lt;exclude&gt;*.template&lt;/exclude&gt;
			&lt;/excludes&gt;
		&lt;/fileSet&gt;

huangapple
  • 本文由 发表于 2020年8月4日 17:23:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/63243834.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定