mojohaus / jaxb2-maven-plugin

JAXB2 Maven Plugin
https://www.mojohaus.org/jaxb2-maven-plugin/
Apache License 2.0
105 stars 76 forks source link

generateEpisode=false does not work #156

Closed zappee closed 4 years ago

zappee commented 4 years ago

I am using jaxb2-maven-plugin to generate POJOs from XSD. I do not need episode file so I turned it off this way:

<generateEpisode>false</generateEpisode>

But it seems that this setting does not work because the plugin still generating an episode file under the given directory: src/main/java/META-INF/JAXB/episode_default.xjb

This is so bad because this file appears in the source directory after each maven build.

The only one workaround I have found is to add this crazy directory to the gitignore list to avoid to be pushed to the source code repo.

Plugin version: 2.5.0

configuration:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxb2-maven-plugin</artifactId>
    <version>2.5.0</version>
    <executions>
        <execution>
            <goals>
                <goal>xjc</goal>
            </goals>
        </execution>
    </executions>
    <configuration>

        <xjbSources>
            <xjbSource>src/main/resources/schema/binding</xjbSource>
        </xjbSources>

        <sources>
            <source>src/main/resources/schema/message.xsd</source>
        </sources>

        <packageName>a.b.model</packageName>
        <clearOutputDir>false</clearOutputDir>
        <outputDirectory>src/main/java</outputDirectory>
        <noGeneratedHeaderComments>true</noGeneratedHeaderComments>
        <noPackageLevelAnnotations>true</noPackageLevelAnnotations>
        <readOnly>true</readOnly>

        <generateEpisode>false</generateEpisode>
    </configuration>
</plugin>
lennartj commented 4 years ago

You should really not use the outputDirectory to stash the sources under src/main/java. They are generated sources, and should go under target/generated-sources/jaxb2 which is the default.

The sources will still be included in the compilation unit when stashed in the generated sources directory.

zappee commented 4 years ago

Thanks for the useful response.