codingEnthu
codingEnthu

Reputation: 11

Maven and XSD [ERROR] Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate (default): Unable to parse input schema(s)

I am working on an application which had many maxOccurs="unbounded" in the XSD files like

<xs:element name="bar" maxOccurs="unbounded" />

and

<xsd:choice maxOccurs="unbounded">

I learnt that this a actually a vulnerability to keep it unbounded and I changed it to first "4095" and then to "100" and on running mvn clean install, both are throwing the following errors

[INFO] --- jaxb2:0.12.3:generate (default)
[INFO] Up-to-date check for source resources [[file: filesnames..... ]]
[INFO] Sources are not up-to-date, XJC will be executed.          
[ERROR] Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.12.3:generate (default) on project projectName: Unable to parse input schema(s). Error messages should have been provided. -> [Help 1]

How to solve this? Also what is the maximum number which can be used in maxOccurences?

Upvotes: -1

Views: 882

Answers (2)

Laurent Schoelens
Laurent Schoelens

Reputation: 2848

I totally agree with Karsten response

If you want to know how to get latest version of highsource's maven-jaxb2-plugin, feel free to check the migration guide

We did many refactoring in order to provide best jakarta support in latest versions (starting from v3)

Upvotes: 0

Karsten
Karsten

Reputation: 420

In the past I have had serious problems with the maven-jaxb2-plugin too and again it's frustrating because I can't find the extremely useful Maven Plugin Documentation.

Since these days I go with the org.codehaus.mojo:jaxb2-maven-plugin.

If you don't want to switch to the jaxb2-maven-plugin you should consider to use a newer version of your plugin at least. Version 0.15.3 worked for me finally.

Some notes:

  • With 0.12.3 I needed to add some dependencies to the plugin to get it halfway working which I had to remove with 0.15.3.
  • The whole javax classes have moved to jakarta now. Thus maybe the most recent plugin versions don't work for you.

Upvotes: 1

Related Questions