users@jaxb.java.net

Maven-jaxb-plugin problem when using binding files.

From: Graeme Steyn <g.steyn_at_cqu.edu.au>
Date: Tue, 9 Oct 2007 18:24:58 +1000

Hi,
 
I am attempting to make use of the 1.1 version of the maven-jaxb-plugin
and have been experiencing a problem when attempting to use a binding
file. Any assistance would be greatly appreciated. The details of the
problem appear below.
 
Thank you.
 
Regards,
 
Graeme.
 
 
 
Basically, if I have the following binding file defined:
 
binding.xjb:
========
 
<?xml version='1.0' encoding='utf-8' ?>
<jxb:bindings version="2.0"
    xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" >
    <jxb:bindings node="/xs:schema" schemaLocation="catalog.xsd" >
        <jxb:schemaBindings>
            <jxb:package name="com.apress.jaxb2.example" ></jxb:package>
        </jxb:schemaBindings>
    </jxb:bindings>
</jxb:bindings>
 
And I use the following in the pom, then the build process works.
 
Success with POM:
==============
 
            <plugin>
                <groupId>com.sun.tools.xjc.maven2</groupId>
                <artifactId>maven-jaxb-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
 
<generatePackage>au.edu.cqu.generated</generatePackage>
                    <excludeBindings>
                        <excludeBinding>*.xjb</excludeBinding>
                    </excludeBindings>
                </configuration>

The moment I change the POM to use the xjb file, the build fails.
 
Failure with POM:
=============
 
            <plugin>
                <groupId>com.sun.tools.xjc.maven2</groupId>
                <artifactId>maven-jaxb-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
 
<generatePackage>au.edu.cqu.generated</generatePackage>
                </configuration>

The resulting error message is:
 
[jaxb:generate {execution: default}]
D:\steyng\Books Source Code\Pro XML Development with Java
Technology\SourceCode-Ch1-7\mavenproject2\target\generated-sources\xjc\a
u\edu\cqu\generated is not found and thus excluded from the dependency
check
Compiling
file:/D:/steyng/Books%20Source%20Code/Pro%20XML%20Development%20with%20J
ava%20Technology/SourceCode-Ch1-7/mavenproject2/src/main/resources/catal
og.xsd
[ERROR][ERROR] "file:/D:/steyng/Books Source Code/Pro XML Development
with Java
Technology/SourceCode-Ch1-7/mavenproject2/src/main/resources/catalog.xsd
" is not a part of this compilation. Is this a mistake for
"file:/D:/steyng/Books Source Code/Pro XML Development with Java
Technology/SourceCode-Ch1-7/mavenproject2/src/main/resources/bindings.xj
b"?
[ERROR] line 5 of
file:/D:/steyng/Books%20Source%20Code/Pro%20XML%20Development%20with%20J
ava%20Technology/SourceCode-Ch1-7/mavenproject2/src/main/resources/bindi
ngs.xjb
[ERROR]
failure in the XJC task. Use the Ant -verbose switch for more details
------------------------------------------------------------------------
[ERROR]FATAL ERROR
------------------------------------------------------------------------
unable to parse the schema. Error messages should have been provided
------------------------------------------------------------------------
Trace
unable to parse the schema. Error messages should have been provided
 
        at com.sun.tools.xjc.XJC2Task._doXJC(XJC2Task.java:453)
        at com.sun.tools.xjc.XJC2Task.doXJC(XJC2Task.java:397)
        at com.sun.tools.xjc.XJC2Task.execute(XJC2Task.java:332)
        at com.sun.tools.xjc.maven2.XJCMojo.execute(XJCMojo.java:310)
        at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginMa
nager.java:417)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Default
LifecycleExecutor.java:610)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifec
ycle(DefaultLifecycleExecutor.java:551)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultL
ifecycleExecutor.java:530)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandle
Failures(DefaultLifecycleExecutor.java:309)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
DefaultLifecycleExecutor.java:276)
        at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifec
ycleExecutor.java:143)
        at
org.codehaus.mevenide.netbeans.embedder.exec.MyLifecycleExecutor.execute
(MyLifecycleExecutor.java:92)
        at
org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:393)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:182)
        at
org.apache.maven.embedder.MavenEmbedder.execute(MavenEmbedder.java:760)
        at
org.codehaus.mevenide.netbeans.execute.MavenJavaExecutor.run(MavenJavaEx
ecutor.java:199)
        at
org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:129)