Maven JAXB plugin that only throws one exception

I am trying to generate sources from two schemes XSD. My maven plugin JAXBlooks 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 is generated by a fine. But the second is not. I see 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 the files are updated, but they are not even created. What could be wrong?

+5
source share
4 answers

I solved the problem. I changed the maven plugin to the maven jaxbplugin jaxb2and now everything works. Now my maven configuration looks like this:

<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <version>0.8.2</version>
    <executions>
        <execution>
            <id>GenerateKenexa</id>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <schemaDirectory>src/main/resources/xsd</schemaDirectory>
                <schemaIncludes>
                    <include>KenexaXMLConfiguration.xsd</include>
                </schemaIncludes>
                <generatePackage>com.groupgti.onlinetest.kenexa.jaxb</generatePackage>
                <generateDirectory>${project.build.directory}/generated-sources/kenexa</generateDirectory>
            </configuration>
        </execution>
        <execution>
            <id>GenerateTalentQ</id>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <schemaDirectory>src/main/resources/xsd</schemaDirectory>
                <schemaIncludes>
                    <include>TalentQXMLConfiguration.xsd</include>
                </schemaIncludes>
                <generatePackage>com.groupgti.onlinetest.talentq.jaxb</generatePackage>
                <generateDirectory>${project.build.directory}/generated-sources/talentq</generateDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>
+4
source

For people who came to this issue, like me, a year later: /

maven-jaxb2-plugin, , - 0.8.3. , "" , .

,

<forceRegenerate>true</forceRegenerate>

.

+11

-, xsd <outputdirectory>${basedir}/target/generated-sources/xjc</outputdirectory>

-, , :

<plugin>
    <groupId>com.sun.tools.xjc.maven2</groupId>
...
<includeSchema>**/KenexaXMLConfiguration.xsd...
...
</plugin>
<plugin>
    <groupId>com.sun.tools.xjc.maven2</groupId>
...
<includeSchema>**/TalentQXMLConfiguration.xsd...
...
</plugin>
+1

jaxb2, , . , . , , :

<generateDirectory>${project.build.directory}/generated-sources/kenexa</generateDirectory>

<id>GenerateKenexa</id>

But different directories make the code nested in two top-level packages, so finally I use:

<forceRegenerate>true</forceRegenerate>
+1
source

All Articles