-1

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

buttowski
  • 4,657
  • 8
  • 27
  • 33
  • please find above what i have tried – buttowski Nov 14 '12 at 11:13
  • 1
    Well I think the question has changed. Previously you were asking about how to. Now, after edition, it looks like you know the how to, but the solution is not working... just guessing because you did not comment the result of your solution. Any error? – jddsantaella Nov 14 '12 at 11:15
  • No plugin found for perfix 'generate' am getting something like this – buttowski Nov 14 '12 at 11:27
  • 1) Don't add the plugin as a dependency... 2) Read and understand everything here: http://confluence.highsource.org/display/MJIIP/User+Guide 3) Try again yourself 4) Come back here and ask again. Cheers – Anders R. Bystrup Nov 14 '12 at 12:00

2 Answers2

1

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,

Anders R. Bystrup
  • 15,729
  • 10
  • 59
  • 55
1

i just changed my goal to xjc and mvn jaxb2:xjc it worked i was able to get the jxb classes generated

buttowski
  • 4,657
  • 8
  • 27
  • 33