简体   繁体   中英

No JAXB Classes Generated from xsd using Maven Plugin

am not able see any of jaxb classes generated from my xsd using jaxb2-maven-plugin

    <bulid>
    <pluginManagement>
    <plugins>
        <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <version>1.5</version>
        <executions>
            <execution>
                <phase>generate-sources</phase>
                <goals>
                    <goal>generate</goal>
                </goals>
            </execution>
        </executions>
        <configuration>

            <schemaDirectory>src/main/xsd</schemaDirectory>
<sourceGenerationDirectory>target/sources</sourceGenerationDirectory>
<classGenerationDirectory>target/classes</classGenerationDirectory>
        </configuration>
        </plugin>
    </plugins>
    </pluginManagement>
    </bulid>
    <dependencies>
    <dependency>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <version>1.5</version>
    </dependency>

and i ran my pom by giving clean install generate:generate is that a correct way ? please suggest a way to generate jaxb classes

i even tried to run by mvn generate-sources nothing is getting generated

This has worked for me at some point in time; you can work from there:

<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>
        <removeOldOutput>false</removeOldOutput>
        <schemaDirectory>src/main/resources/xsd</schemaDirectory>
        <includeBindings>
            <includeBinding>*.xjb</includeBinding>
        </includeBindings>
    </configuration>
</plugin>

The plugin is bound to the generate-sources phase.

Cheers,

我只是将目标更改为xjc和mvn jaxb2:xjc,它的工作原理是我能够生成生成的jxb类

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM