从pom.xml设置`file.encoding` [英] Set `file.encoding` from `pom.xml`

查看:246
本文介绍了从pom.xml设置`file.encoding`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在pom.xml中加入什么咒语,等同于

What incantation do I put into pom.xml which will be equivalent to

export JAVA_TOOL_OPTIONS='-Dfile.encoding=UTF-8'

.profile中? 我尝试过

<configuration>
    <file.encoding>UTF-8</file.encoding>
</configuration>

maven-compiler-plugin

<properties>
    <file.encoding>UTF-8</file.encoding>
</properties>

在顶层,它不起作用.

主要思想是从环境的pom.xml NOT 中进行设置 (我没有控制将在何种环境下运行). 同样,我对修改.profile等人的任何解决方案都不感兴趣.

The main idea is to set this from pom.xml, NOT from the environment (I have no control over what environment this will be run under). Again, I am not interested in any solution which modifies .profile et al.

推荐答案

尝试以下操作:

    <configuration>
     ...
     <systemProperties>
        <systemProperty>
          <name>propertyName</name>
          <value>propertyValue</value>
        </systemProperty>
        ...
     </systemProperties>
    </configuration>

这应该有效.至少它与其他Maven插件一起对我有用.

This should work. At least it works for me with other maven plugins.

这篇关于从pom.xml设置`file.encoding`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆