Pregunta

When I try to use maven-jaxb-schemagen-plugin with java 7

<groupId>com.sun.tools.jxc.maven2</groupId>
<artifactId>maven-jaxb-schemagen-plugin</artifactId>
<version>1.2</version>

I get an error:

[ERROR] Failed to execute goal com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.2:generate (default) on project TopologyProvisionerDom: Execution default of goal com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.2:generate failed: A required class was missing while executing com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.2:generate: com/sun/mirror/apt/AnnotationProcessorFactory

It seems like the AnnotationProcessorFactory is being removed/deprecated in Java 7? Is it possible to get jaxb schemagen to work using this plugin? Is there an alternative approach to get schema generation from the JAXB source code when using JDK 7?

¿Fue útil?

Solución

Have you tried using the org.codehaus.mojo:jaxb2-maven-plugin instead?

Otros consejos

This is how it works (add this profile to your pom.xml):

<profile>
    <id>jdk7-fix</id>
    <activation>
        <file><exists>${java.home}/../lib/tools.jar</exists></file>
    </activation>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.sun.tools.jxc.maven2</groupId>
                    <artifactId>maven-jaxb-schemagen-plugin</artifactId>
                    <dependencies>
                        <dependency>
                            <groupId>com.sun</groupId>
                            <artifactId>tools</artifactId>
                            <version>1.7</version>
                            <scope>system</scope>
                            <systemPath>${java.home}/../lib/tools.jar</systemPath>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</profile>

Not sure anyone is listening to this thread anymore but, what the hey...

I used the transformSchemas option e.g.

<transformSchemas>
    <transformSchema>
        <uri>YOUR NS IN YOUR GENERATED SCHEMA FILE</uri>
        <toFile>DESIRED NAME OF YOUR XSD FILE</toFile>
    </transformSchema>
</transformSchemas>

cheers

-m.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top