<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.7.14</version>
    <relativePath/> <!-- lookup parent from repository -->
  </parent>
  <groupId>com.example</groupId>
  <artifactId>demo</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>demo</name>
  <description>Demo project for Spring Boot</description>
  <properties>
    <java.version>17</java.version>
    <jaxb.version>2.3.3</jaxb.version>
    <jax-ws.version>2.3.3</jax-ws.version>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web-services</artifactId>
    </dependency>

    <!-- package JAX-WS for Java 11 and up -->
    <dependency>
      <groupId>jakarta.xml.ws</groupId>
      <artifactId>jakarta.xml.ws-api</artifactId>
      <version>${jax-ws.version}</version>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.ws</groupId>
      <artifactId>jaxws-ri</artifactId>
      <version>${jax-ws.version}</version>
      <type>pom</type>
    </dependency>

    <!-- package JAXB for Java 11 and up -->
    <dependency>
      <groupId>jakarta.xml.bind</groupId>
      <artifactId>jakarta.xml.bind-api</artifactId>
      <version>${jaxb.version}</version>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-impl</artifactId>
      <version>${jaxb.version}</version>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-validation</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.ws</groupId>
      <artifactId>spring-ws-security</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <version>3.5.6</version>
        <executions>
          <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
              <sourceRoot>${basedir}/target/generated-sources/ws</sourceRoot>

              <wsdlOptions>
                <wsdlOption>

                  <wsdl>${basedir}/src/main/resources/wsdl/SalaryDeclarationConsumerService.wsdl</wsdl>
                  <bindingFiles>
                    <bindingFile>${basedir}/src/main/resources/bindings/bindings.xjc</bindingFile>
                  </bindingFiles>

                  <extraargs>
                    <extraarg>-validate</extraarg>
                    <extraarg>-verbose</extraarg>
                    <extraarg>-autoNameResolution</extraarg>
                    <extraarg>-xjc-verbose</extraarg>

                    <extraarg>-exceptionSuper</extraarg>
                    <extraarg>java.lang.RuntimeException</extraarg>
                  </extraargs>
                </wsdlOption>
                <wsdlOption>

                  <wsdl>${basedir}/src/main/resources/wsdl/SalaryDeclarationService.wsdl</wsdl>
                  <bindingFiles>
                    <bindingFile>${basedir}/src/main/resources/bindings/bindings.xjc</bindingFile>
                  </bindingFiles>

                  <extraargs>
                    <extraarg>-validate</extraarg>
                    <extraarg>-verbose</extraarg>
                    <extraarg>-autoNameResolution</extraarg>
                    <extraarg>-xjc-verbose</extraarg>

                    <extraarg>-exceptionSuper</extraarg>
                    <extraarg>java.lang.RuntimeException</extraarg>
                  </extraargs>
                </wsdlOption>
              </wsdlOptions>
            </configuration>
            <goals>
              <goal>wsdl2java</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
