Generate Java Code From Xml Schema using JAXB
Answered
Hi,
In my maven project, I have a xsd file and I'd like to generate corresponding java classes using jaxb.
So I select my xsd then Tools -> Generate Java Code From Xml Schema using JAXB...
Ok, its working. BUT the problem is that the generated classes are not UTF-8 encoded (it is windows 1252) and (my Windows 10 is in french) the added comments like
* <p>The following schema fragment specifies the expected content contained within this class...
are in french with accentuated characters.
So Intellij complains that "File was loaded with the wrong encoding 'UTF-8'.
* <p>Le fragment de sch�ma suivant indique le contenu attendu figurant dans cette classe.
and it displays wrong and there are compilation errors (unmappable character for encoding UTF-8).
My maven project is configured for using UTF-8, all my files are in UTF-8.
What's the solution ?
Please sign in to leave a comment.
Hello.
Please provide a screenshot of File | Settings | Editor | File Encodings
Hello,
Global Encodings was set to UTF-8, but Project Encodings and Default encoding for properties files were set to system-default (windows 1252).
Now everything is in UTF-8 and all folders also in UTF-8.
But still the same problem.
Please check encoding of xsd file and switch it to UTF-8:
https://www.jetbrains.com/help/idea/configuring-individual-file-encoding.html
My xsd was already in UTF-8. I still added (in the settings) the path of my xsd and set it to UTF-8.
Still the same problem :-(
Hello.
Looks like it is a known issue, please follow https://youtrack.jetbrains.com/issue/IDEA-145849
As a workaround please use Maven task to generate xml, as it allows to set encoding manually.
Thanks Petr for trying to help me.
But there is something I don't understand: the issue you're talking about is ... 3 years old !
It is not fixed ?
My boss asked us to 'migrate' from eclipse to intellij. It was working with eclipse (free).
That fonctionnality is only available with the ultimate version (paid) and ... it is not working.
Hello.
The developer is currently looking into the problem, please follow https://youtrack.jetbrains.com/issue/IDEA-145849