如何在 exec-maven-plugin 中设置 file.encoding 属性?
我尝试通过 exec-maven-plugin 执行我的独立应用程序,但它以 WIN 编码开始,而不是 UTF-8。我读到了有关 Java 命令行键 -Dfile.encoding=UTF-8 的信息。如何将此属性设置到我的应用程序? 谢谢。
Maven pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<executable>java</executable>
<mainClass>my.main.Class</mainClass>
</configuration>
</plugin>
I trying to exec my standalone application via exec-maven-plugin, but it started with WIN encoding, not UTF-8. I read about Java command line key -Dfile.encoding=UTF-8. How to set this property to my application?
Thanx.
maven pom:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<executable>java</executable>
<mainClass>my.main.Class</mainClass>
</configuration>
</plugin>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要设置
mvn exec:java
的编码,请设置MAVEN_OPTS
环境变量,例如:以下是 exec-maven-plugin 用法 页面显示:
To set encoding for
mvn exec:java
, setMAVEN_OPTS
environment variable, e.g.:Here is what exec-maven-plugin usage page says:
根据 exec-maven-plugin 文档,它应该如下所示:
According to the exec-maven-plugin documentation, it should look like this:
比 Todd 的方法更直接(不过他的方法仍然很酷):
示例此处。
more direct method than Todd's (his one's still cool though):
samples here.