user3417479
user3417479

Reputation: 1910

Cannot generate classes from xsd, in Intellij with Maven

I have a Java project in IntelliJ with Maven. The project contains a couple of xsd files and I want to generate java classes from them. My pom.xml is like this

<build>
<plugins>
  <plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-xjc-plugin</artifactId>
    <version>3.3.1</version>
    <executions>
      <execution>
        <id>xjc</id>
        <phase>generate-sources</phase>
        <goals>
          <goal>xsdtojava</goal>
        </goals>
        <configuration>
          <xsdOptions>
            <xsdOption>
              <xsd>/src/main/resources/BulkValuations.xsd</xsd>
            </xsdOption>
            <xsdOption>
              <xsd>/src/main/resources/TPSData.xsd</xsd>
            </xsdOption>
          </xsdOptions>
        </configuration>
      </execution>
    </executions>
  </plugin>
</plugins>

Then I right click on the module and choose Maven->Generate Sources and Update Folders. Unfortunately no classes are created under target->generated-sources.

I would be grateful for any help.

Upvotes: 1

Views: 5593

Answers (1)

xerx593
xerx593

Reputation: 13261

Sorry, cannot reproduce, bud! (i.e. "works like charm", see khmb's comment)

https://github.com/xerx593/soq69358909

Sorry, cannot reproduce!

  • Import with IntelliJ, Run (project Context->)Maven-> Generate Sources And Update Folders
  • Run mvn clean install

Sources are generated into target/generated/src/main/java.

Environment

  • (latest) IntelliJ Community Edition: 2021.2.2
  • Oracle Winx64 JDK: 17

Thanks to

https://www.w3schools.com/xml/schema_example.asp for sample xsd!

Upvotes: 1

Related Questions