mojohaus / jaxb2-maven-plugin

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

ObjectFactory not being compiled with newest version #253

Open eric-a-braun opened 1 year ago

eric-a-braun commented 1 year ago

I am attempting to generate Java classes from an xsd schema using version 3.1.0 which is an upgrade where I am now using Java 17 and Spring boot 3

All classes generate to the specified location correctly (as .class), with the exception of the ObjectFactory being generated as a non-compiled .java file

Due to this happening my IDE is unable to resolve the ObjectFactory even though it exists (both through imports in separate projects and in the same project without an import as I was doing prior to upgrade)

Plugin setup (omitted package name, but everything else is included):

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-compiler-plugin</artifactId>
   <version>3.11.0</version>
   <configuration>
      <release>${java.version}</release>
   </configuration>
</plugin>
<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-surefire-plugin</artifactId>
   <version>2.22.2</version>
</plugin>
<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>jaxb2-maven-plugin</artifactId>
   <version>3.1.0</version>
   <executions>
      <execution>
         <id>xjc</id>
         <goals>
            <goal>xjc</goal>
         </goals>
      </execution>
   </executions>
   <configuration>
      <xjbSources>
         <xjbSource>${basedir}/src/main/resources/xjb/bindings.xjb</xjbSource>
      </xjbSources>
      <sources>
         <source>${basedir}/src/main/resources/xsd/my-xsd.xsd</source>
      </sources>
      <outputDirectory>${project.build.directory}/generated-sources/xjc</outputDirectory>
      <packageName>com....</packageName>
   </configuration>
</plugin>
<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>build-helper-maven-plugin</artifactId>
   <version>3.3.0</version>
   <executions>
      <execution>
         <id>add-source</id>
         <phase>generate-sources</phase>
         <goals>
            <goal>add-source</goal>
         </goals>
         <configuration>
            <sources>
               <source>${project.build.directory}/generated-sources/xjc</source>
            </sources>
         </configuration>
      </execution>
   </executions>
</plugin>

Here is a screenshot of the ide not finding the ObjectFactory: image

And a snapshot of the target directory that I am generating files to: image

I submitted a report to IntelliJ/JetBrains and they stated that the issue seems to be with the plugin.