Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"http://annox.dev.java.net" customizations require the "-Xannotate" switch

I am trying to run a real schema through hyperjaxb. I have tested the schema repeatedly using jaxb, and jaxb imports the schema correctly every time. However, when I try to get hyperjaxb to generate hibernate-annotated java classes from the same schema, I get the following error:

[ERROR] Error while parsing schema(s).Location [ file:/C:/path/to/src/main/resources/schema.xsd{4,32}].
org.xml.sax.SAXParseException; systemId: file:/C:/path/to/src/main/resources/schema.xsd;  
lineNumber: 4; columnNumber: 32; 
Using "http://annox.dev.java.net" customizations requires the "-Xannotate" switch 
to enable this plug-in.

I have googled this error message and read other postings about it, but have not found any clean instructions for resolving it. The closest I have found is this article, which says that the annox plugin is activated by the -Xannotate command-line argument.

I read this link, but adding the following to the xsd file did not eliminate the error, probably because the xsd does not use the jaxb prefix anywhere.

xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
jaxb:version="2.1" 
xmlns:annox="http://annox.dev.java.net" 
jaxb:extensionBindingPrefixes="annox"

I have uploaded a zip file containing all the relevant materials to quickly reproduce the problem to this link. It is a zip file of the project including the intended schema. All you have to do to reproduce the problem is navigate the command line to the root directory of the unzipped project and type mvn clean install to reproduce the error.

How can I resolve this error?


EDIT:

I have experimented with adding the following to plugin configuration in pom.xml, but so far have not had success.

<args>
    <arg>-Xannotate</arg>
</args>  

SECOND EDIT:

I added @lexicore 's suggestions to the pom.xml, but the result is a null pointer exception, which you can read by clicking on this link. To promote easier use of hyperjaxb by others, I am including the full current pom.xml at this link. Together, this revised pom.xml and the above zip file are enough to recreate the problem in a few minutes. Is this a configuration problem or a bug?

like image 588
CodeMed Avatar asked Feb 17 '26 03:02

CodeMed


2 Answers

I will now answer this specific question for the interest of the new users.

If you see the reported error:

Using "http://annox.dev.java.net" customizations requires the "-Xannotate"
switch to enable this plug-in.

It means, well, that you have to include the "-Xannotate" switch to enable this plugin. Please refer to the documentation on the front page of the jaxb2-annotate-plugin:

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <configuration>
        <extension>true</extension>
        <args>
            <arg>-Xannotate</arg>
        </args>
        <plugins>
            <plugin>
                <groupId>org.jvnet.jaxb2_commons</groupId>
                <artifactId>jaxb2-basics-annotate</artifactId>
            </plugin>
            <!-- Add the dependencies with your annotations as 'plugins' below -->
            <plugin>
                <groupId>org.jvnet.jaxb2_commons</groupId>
                <artifactId>jaxb2-annotate-plugin-test-annox-annotations</artifactId>
            </plugin>
        </plugins>
    </configuration>
</plugin>

See the -Xannotate switch? This is it.

jaxb2-annotate-plugin can be used with maven-hyperjaxb3-plugin the same way. Here is a an example from Hyperjaxb tests:

        <plugin>
            <groupId>org.jvnet.hyperjaxb3</groupId>
            <artifactId>maven-hyperjaxb3-plugin</artifactId>
            <configuration>
                <postArgs>
                    <arg>-Xannotate</arg>
                </postArgs>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-search</artifactId>
                    <version>3.0.0.GA</version>
                </dependency>
                <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-annotations</artifactId>
                    <version>3.5.6-Final</version>
                </dependency>
            </dependencies>
        </plugin>

(You don't need to include jaxb2-annotate-plugin as it is already included by maven-hyperjaxb3-plugin automatically.)

like image 100
lexicore Avatar answered Feb 19 '26 15:02

lexicore


You should remove this plugin <artifactId>maven-hyperjaxb3-plugin</artifactId>

        <plugin>
            <groupId>org.jvnet.hyperjaxb3</groupId>
            <artifactId>maven-hyperjaxb3-plugin</artifactId>
            <version>0.6.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <extension>true</extension>
                <roundtripTestClassName>RoundtripTest</roundtripTestClassName>
            </configuration>
        </plugin>
like image 25
Xstian Avatar answered Feb 19 '26 15:02

Xstian