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:
And a snapshot of the target directory that I am generating files to (/generated-sources/xjc):
The target/classes directory does have the ObjectFactory as a class the same as the rest.
As an added note I am pulling in the project that is running this build as a dependency in order to use the classes built, however the same issue occurs in the direct project where the classes are built. It cannot find the ObjectFactory but I can still run tests and compile the project using the import that the ide is telling me does not exist (due to it being .java and not .class)
Wondering if I have something set up wrong for using Jakarta, the plugin, need a different plugin or what is going on. I have tried some combinations of different plugins with no results. I have also tried updating versions of everything with no luck. This worked previously when not using jakarta and jaxb3
Turns out this was an issue with how IntelliJ was configured. I found File size exceeds configured limit (2560000), code insight features not available as I was seeing an alert at the top of my ObjectFactory when opening and following the steps outlined fixed the issue.