Closed n1t4chi closed 4 years ago
having the same problem, is there any solution?
fixed it by upgrading basics to 1.11.1
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>1.11.1</version>
</dependency>
1.11.1
was published by mistake. Please try 0.11.1
or the latest version.
the latest version is 0.12 and there I had the problem
The issue still occurs on the latest 0.12.0 version and in advised 0.11.1 version the problem is simply ignored so you still end up with mismatched declarations and assignments within the generated classes as it was stated at the beginning of this thread:
final EqualsStrategy2 strategy = JAXBEqualsStrategy.INSTANCE;
final HashCodeStrategy2 strategy = JAXBHashCodeStrategy.INSTANCE;
final ToStringStrategy2 strategy = JAXBToStringStrategy.INSTANCE;
But I was able to narrow the source of the problem - the dependency within the plugin. It seems that the issue happens when you add any dependency to the plugin - instead of a plugin section within the plugin.
Hello,
I've found an issue with toString generation when using maven-jaxb2-plugin. Instead of generating JAXBToStringStrategy.INSTANCE2, it uses INSTANCE which is incompatible with ToStringStrategy2 as seen below:
Because of this, the maven build fails on compilation with example error below:
For some reason, when I use same configuration with org.jvnet.jax-ws-commons.jaxws-maven-plugin to generate classes from WSDL, the correct INSTANCE2 is used. I also tried to explicitly give which class to use via: -XtoString-toStringBuilder=org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy or -XtoString-toStringStrategyClass=org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy but nothing changed
Is this some bug or just configuration problem? Could you help please?
POM and XSD file below: pom.xml
XSD [should be placed next to pom]: