This question is specific to IntelliJ. I'll also post this to the IntelliJ Support Community site at https://intellij-support.jetbrains.com/hc/en-us/community/topics. I'm using the latest version of IntelliJ which is 2023.3.4 (Build #IU-233.14475.28, built on February 13, 2024).
I'm currently using the maven plugin com.evolvedbinary.maven.jvnet:jaxb30-maven-plugin:0.15.0
to take *.XSD files and generate POJOs from the XSDs and compile the POJOs into classes for use in my application.
A snippet of my directory structure (for the purposes of this question is):
maven-module1/
src/main/java/org/acme/myapp/Main.java
src/main/resources/xsd/myData.xsd
After running mvn clean install
, the XJB plugin generates sources and maven compiles them and places them into the target/classes directory along with other compiled Java files. Below shows the resultant target/classes
and target/generated-sources
directories.
maven-module1/
target/generated-sources/xjc/org/acme/myapp/myData.java
target/classes/org/acme/myapp/Main.class
target/classes/org/acme/myapp/myData.class
So my generated sources are not put into a normal src/main/java
sub-directory but instead put into a sub-directory inside of the target directory.
<properties>
<maven-jaxb30-plugin-version>0.15.0</maven-jaxb30-plugin-version>
</properties>
<plugin>
<groupId>com.evolvedbinary.maven.jvnet</groupId>
<artifactId>jaxb30-maven-plugin</artifactId>
<version>${maven-jaxb30-plugin-version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<strict>false</strict>
<schemaIncludes>**/xsd/*.xsd</schemaIncludes>
<bindingIncludes>**/xjb/*.xjb</bindingIncludes>
<useDependenciesAsEpisodes>false</useDependenciesAsEpisoes>
</configuration>
</plugin>
How can I get IntelliJ to use this maven plugin to generate the source code an compile the source code?
NOTE: I've already tried using the IntellIJ plugin described at https://www.jetbrains.com/help/idea/generate-java-from-xml-schema-using-jaxb-dialog.html
And found that it had limitations (it wouldn't allow me to enter the output directory of target/generated-sources)
What I'm trying to achieve is this:
Currently, my work around is to run maven clean install from the command line of that maven module directory to have the XSD POJOs generated and compiled.
I got the following answer from IntelliJ/JetBrains tech support:
It's not possible to set custom tool for file generation.