hyperjaxb3
hyperjaxb3 copied to clipboard
encoding problem with maven-jaxb2-plugin
Hi, iam testing those projects from http://confluence.highsource.org/display/HJ3/Downloads to generate some java files from xsd.
I got it working with maven-hyperjaxb3-plugin, generating UTF-8 files like i wanted, but it didnt with maven-jaxb2-plugin and hyperjaxb3-ejb-plugin . I got encoding issues with those plugins. I tried to set
- Basic project template for Hibernate MAVEN (only that generated utf-8 java files)
- Purchase order initial sample for Hibernate MAVEN (got encoding issue)
- Purchase order build with maven-jaxb2-plugin MAVEN (got encoding issue)
Any tips about it?
Also, i realize that the source code generated with those projects are differents. For example:
//Advogado
<xs:element name="advogado" type="nsS:Pessoa"/>
//Pessoa
<xs:complexType name="Pessoa">
<xs:annotation>
<xs:appinfo>
<hj:entity xmlns:hj="http://hyperjaxb3.jvnet.org/ejb/schemas/customizations">
<orm:sequence-generator name="Generator_PESSOA" sequence-name="SEQ_PESSOA" xmlns:orm="http://java.sun.com/xml/ns/persistence/orm"/>
</hj:entity>
</xs:appinfo>
</xs:annotation>
<xs:sequence>
...
with maven-hyperjaxb3-plugin generates this:
....
@Entity(name = "Advogado")
@Table(name = "ADVOGADO")
@Inheritance(strategy = InheritanceType.JOINED)
public class Advogado
....
with maven-jaxb2-plugin and hyperjaxb3-ejb-plugin generates this:
...
@Entity(name = "Advogado")
@Table(name = "ADVOGADO",schema="selodig")
@Inheritance(strategy = InheritanceType.JOINED)
@SequenceGenerator(name = "Generator_ADVOGADO", sequenceName = "seq_advogado")
public class Advogado
...
so, whats happening?
Thanks
I would appreciate if questions were asked separately.
First of all, I'm not actively developing this project anymore, be aware of that.
Next, I'd definitely drop the maven-hypejaxb3-plugin. It just configures around maven-jaxb2-plugin, that's not enough added value from my POV. So better stick with maven-jaxb2-plugin/hyperjaxb3-ejb-plugin combo, you have better chances for updates then.
Next, when analyzing Maven problems it's always good to have mvn -X clean install log, both std as well as err.
You report differences between maven-hypejaxb3-plugin and maven-jaxb2-plugin/hyperjaxb3-ejb-plugin combo. I'd prefer not to analyze these for the following reasons:
- There's actually no point doing this. Assume we'll find out why exactly these differences appear. What next? That won't help to fix the actual problem.
- As I said
maven-hypejaxb3-pluginis actually the same asmaven-jaxb2-plugin/hyperjaxb3-ejb-plugincombo, just pre-configured. Differences are possible due to possibly different versions of the used dependencies and/or differences in configs.
Encoding: set project.build.sourceEncoding, see this. Alternatively just set encoding configuration property in maven-jaxb2-plugin (it uses project.build.sourceEncoding by default). I don't know why is this different, I don't see any relevant settings in templates vs. other projects.
Different code generated - I'd first think about different versions but that's hard to tell. Do you actually have a problem with this?