JAXB english comments in generated file

久未见 提交于 2019-12-12 11:35:53

问题


I use XJC to compile some XSD to Java classes. On my machine, instead of the usual comment

// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11 

I get the same comment but in italian

// Questo file è stato generato dall'architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.11 

XJC is invoked with Maven plugin maven-jaxb2-plugin:0.12.0:generate.
Same pom generates different comments on different machines. How do I switch comments back to English? I run it on JDK 1.8.0_66 on Windows 10 with Italian locale.


回答1:


You can specify a locale that will be used during generation of the classes, with the help of the <locale> attribute.

locale - Locale used during generation, for instance en, de, fr etc. This will, for instance, influence the language of the generated JavaDoc comments.

By default, maven-jaxb2-plugin will use your user locale. Sample configuration for the plugin would be:

<configuration>
  <locale>en</locale> <!-- this will use the English locale -->
</configuration>


来源:https://stackoverflow.com/questions/34549107/jaxb-english-comments-in-generated-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!