2

tl;dr: how to stop maven using localized (German) error messages?

I have a maven project in eclipse, that I use only to create jaxb classes from xsds (using Run as-> Maven generate-sources from context menu). There are some problems, and I'm trying to solve them, but for some reason my system finds it a good idea to give me error messages in German. Those are not helpful at all for finding help on the internet.

My Windows is a German version, but my eclipse is not, and nowhere did I specify in the pom to use German language (nor did I specify to use English - googling for "maven pom set language" only tells me how to specify a java version).

I don't know if it is possible, that my maven is fetching localized versions of jars to my maven repository. If that would be the case, I'd want it to stop doing that.

Anyone knows how to stop maven/java/eclipse/jaxb from providing German error messages? I'm tired of having to guess what the English text would be.

Additional information

My pom.xml is modelled after https://stackoverflow.com/a/2857613/1358283. Here is the <build> part:

<build>
    <plugins>
        <plugin>
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <version>0.12.3</version>
            <executions>
                <execution>
                    <id>generate-schema-statusinformation</id>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <generateDirectory>target/msg</generateDirectory>
                        <schemaDirectory>${schemaBaseDir}/xsds/StatusInformation</schemaDirectory>
                        <generatePackage>${schemaBasePackage}.statusinformation</generatePackage>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <source>${maven.compiler.source}</source>
                <target>${maven.compiler.target}</target>
            </configuration>
        </plugin>
    </plugins>
</build>

And here is part of my (anonymised) error output with the partly German text:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building My-Messages 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-jaxb2-plugin:0.12.3:generate (xxx) @ my-messages ---
[INFO] Up-to-date check for source resources [[file:/C:/xxx/StatusInformation.xsd, file:/C:/xxx/pom.xml]] and taret resources [[]].
[INFO] Sources are not up-to-date, XJC will be executed.
[ERROR] Error while parsing schema(s).Location [ file:/C:/xxx/StatusInformation.xsd{493,60}].
com.sun.istack.SAXParseException2; systemId: file:/C:/xxx/StatusInformation.xsd; lineNumber: 493; columnNumber: 60; Element "Remarks" ist in mehr als einer Eigenschaft vorhanden.
    at com.sun.tools.xjc.ErrorReceiver.error(ErrorReceiver.java:86)
    at com.sun.tools.xjc.reader.ModelChecker.check(ModelChecker.java:92)
...

(this question is not meant for finding help with that specific error, only for the language problem)

Community
  • 1
  • 1
kratenko
  • 7,354
  • 4
  • 36
  • 61

1 Answers1

2

xjc contains localized text resources for error messages and comments inserted into the generated files, so the usual rules for locale resolving apply.

The locale for your Java VM is defined by the user.language system property which is initialized from the LANG environment variable on Unix systems.

(I don't have Windows, so you'll have to find out the corresponding setting for yourself.)

To override the German defaults on my system, I simply invoke Maven like this:

LANG=en mvn clean install

When using Run as | Maven build in Eclipse, you can set this environment variable on the Environment tab of the Maven launch configuration.

Harald Wellmann
  • 12,615
  • 4
  • 41
  • 63