Search code examples
javamavenjaxbjavadoc

jaxb - unmarshalling `>` character problem with javadoc


I'm using

<cxf-version>3.4.4</cxf-version>
<springframework.version>4.1.6.RELEASE</springframework.version>
<slf.version>1.7.9</slf.version>

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.3.0</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-core</artifactId>
    <version>2.3.0</version>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.3.0</version>
    <scope>provided</scope>
</dependency>

then in java:

final Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
jaxbUnmarshaller.setSchema(schema);

but then there is an error while An error has occurred in JavaDocs report generation:

[ERROR] /builds/provisioning/target/generated-sources/cxf/at/ActionType.java:26: error: bad use of '>'
[ERROR]  * &lt;complexType name="actionType">

it seems like < is correctly escaped into &lt; but > is not escaped and goes as > which causes error for me. I found jaxbUnmarshaller.setProperty("jaxb.encoding", "Unicode"); but it change nothing in this example.


Solution

  • There is a way to fix instead of using <additionalparam>Xdoclint:none</additionalparam>. I used all newest versions of cfx and jaxb in pom.xml and worked (generated &lt and &gr instead of < and >) so seems it was fixed in jaxb lib.

    (It didn't work for me earlier because of versions of these in poms and parent pom)