mojohaus / jaxb2-maven-plugin

JAXB2 Maven Plugin
https://www.mojohaus.org/jaxb2-maven-plugin/
Apache License 2.0
106 stars 77 forks source link

Provide a way to specify character encoding of files that do not produce maven warning #50

Closed rwold-resilient closed 7 years ago

rwold-resilient commented 8 years ago

There is currently no manner of providing a platform-independent (more specifically native-text-file-encoding-independent) build file using the jaxb2-maven-plugin without getting a warning from maven on at least some platforms:

[WARNING] Configured encoding [UTF-8] differs from encoding given in system property 'file.encoding' [Cp1252]

This warning is produced despite specifying UTF-8 in project.build.sourceEncoding in the pom generally, and the configuration specifically for the plugin.

42 looks like it fixes this, but was closed as invalid after what looks like a misunderstanding of what the PR does. Regardless, if that is not the fix, I would like some manner of configuring projects so they work without warnings both on linux where file.encoding is UTF-8 and windows where file.encoding is Cp1252; it should be possible to have a platform independent build, without training other developers to be blind to warnings.

alexey-su commented 8 years ago

Look https://maven.apache.org/plugins/maven-resources-plugin/examples/encoding.html The property "project.build.sourceEncoding" specifies the encoding of the generated classes. I implemented this functionality in version 1.x

See also http://www.mojohaus.org/jaxb2-maven-plugin/Documentation/v2.2/xjc-mojo.html Property "encoding".

rwold-resilient commented 8 years ago

Yes, I am aware of those options, and specify both as indicated in my original post. This issue is about getting a warning from maven when doing so.

Specifically, I would like, if I have specified both, to have the build be entirely independent of file.encoding. But in the current (2.2) version, whether you get a warning or not depends on whether the specified encoding differs from file.encoding, even if the build is not otherwise affected.

All I want is a build without warnings.

andham commented 7 years ago

I agree, this warning is not right. Using the project.build.sourceEncoding property is the Maven way and should not produce a warning. I'd argue that using the file.encoding system property is bad usage as it would make build platform dependent. That should produce a warning.

andham commented 7 years ago

I'm changing this ticket to 'bug' as the current (log) behavior is not aligned with the Maven way.