javajaxbmaven-pluginmaven-jaxb2-plugin

StaleFile element not allowed with jaxb2 version 2


I'm upgrading our jaxb2-maven-plugin from version 1.5 to 2.5. After changing the schemaDirectory and schemaFiles to use the source tags it builds and works as before.

However the staleFile tag is being highlighted as an error in intellij with the message "Element staleFile is not allowed here"

I've not been able to find any documentation on what to do with this tag in version 2+ of jaxb

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <version>2.5.0</version>
        <configuration>
            <clearOutputDir>false</clearOutputDir>
            <extension>true</extension>
        </configuration>
        <executions>
            <execution>
               <id>company-binding-directAuthorizeReq</id>
               <goals>
                   <goal>xjc</goal>
               </goals>
               <configuration>
                   <sources>
                       <source>${company.schema.location}/directAuthorizeReq.xsd</source>
                   </sources>
                   <outputDirectory>${generated.source.location}</outputDirectory>
                   <packageName>${company.model.package}.directAuthorizeReq</packageName>
                   <staleFile>${project.build.directory}/jaxb2/.jaxb-staleFlag-directAuthorizeReq</staleFile>
               </configuration>
           </execution>
       </executions>
</plugin>

Solution

  • There is a new element named <staleFileDirectory>.