Maven JAXB plugin executing only one excecution

Paulius Matulionis picture Paulius Matulionis · Aug 31, 2012 · Viewed 14.2k times · Source

I am trying to generated sources from two XSD schemas. My JAXB maven plugin looks like this:

<plugin>
    <groupId>com.sun.tools.xjc.maven2</groupId>
    <artifactId>maven-jaxb-plugin</artifactId>
    <version>1.1.1</version>
    <executions>
        <execution>
            <id>GenerateKenexa</id>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <includeBindings>
                    <includeBinding>**/jaxb-bindings-kenexa.xml</includeBinding>
                </includeBindings>
                <includeSchemas>
                    <includeSchema>**/KenexaXMLConfiguration.xsd</includeSchema>
                </includeSchemas>
            </configuration>
        </execution>
        <execution>
            <id>GenerateTalentQ</id>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <includeBindings>
                    <includeBinding>**/jaxb-bindings-talentq.xml</includeBinding>
                </includeBindings>
                <includeSchemas>
                    <includeSchema>**/TalentQXMLConfiguration.xsd</includeSchema>
                </includeSchemas>
            </configuration>
        </execution>
    </executions>
</plugin>

The first one gets generated fine. But the second one does not. I see in the maven output:

[INFO] --- maven-jaxb-plugin:1.1.1:generate (GenerateKenexa) @ online.tests.management ---
[INFO] Compiling file:/D:/Projects/GTIWebApplications/gti_online_tests_management/src/main/resources/xsd/KenexaXMLConfiguration.xsd
[INFO] Writing output to D:\Projects\GTIWebApplications\gti_online_tests_management\target\generated-sources\xjc
[INFO] 
[INFO] --- maven-jaxb-plugin:1.1.1:generate (GenerateTalentQ) @ online.tests.management ---
[INFO] files are up to date

It says that files are up to date, but they aren't even generated. What might be wrong?

Answer

Jan Nielsen picture Jan Nielsen · Apr 19, 2013

For people coming in to this question as I did, a year later :/

The problem persists in maven-jaxb2-plugin aswell, it's probably some sort of bug in 0.8.3. When you generate the files into the same directory, the plugin "thinks" that the files have allready been generated and skips that second execution.

I found that in order to generate the second execution you will have to set the argument

<forceRegenerate>true</forceRegenerate>

In the configuration section.