<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <artifactId>user-model</artifactId>
    <name>${project.parent.artifactId}-model</name>   
    <packaging>ejb</packaging>
    <description>This module shall have interfaces, XSD, and DTOs</description>

    <parent>
        <groupId>fish.focus.uvms.user</groupId>
        <artifactId>user</artifactId>
        <version>2.2.3</version>
    </parent>
    
    <properties>
        <!-- the name of the wsdlfiles wothout fileending -->
        <wsdl.contract.name>UserModuleService</wsdl.contract.name>        
    </properties>

    <dependencies>
        <dependency>
            <groupId>fish.focus.uvms.maven</groupId>
            <artifactId>uvms-pom-java11-deps</artifactId>
            <version>3.8</version>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.3.3</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
    <profiles>
        <profile>
            <id>generate-from-wsdl</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-clean-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>clean-generated-sources</id>
                                <phase>clean</phase>
                                <goals>
                                    <goal>clean</goal>
                                </goals>
                                <configuration>
                                    <filesets>
                                        <fileset>
                                            <directory>${basedir}/src/main/java/eu/europa/ec/fisheries/schema</directory>
                                        </fileset>
                                    </filesets>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.cxf</groupId>
                        <artifactId>cxf-codegen-plugin</artifactId>
                        <version>3.5.0</version>
                        <executions>
                            <execution>
                                <id>generate-user-module</id>
                                <phase>generate-sources</phase>
                                <configuration>
                                    <sourceRoot>${basedir}/src/main/java/</sourceRoot>
                                    <wsdlOptions>
                                        <wsdlOption>
                                            <!-- This is for incoming and outgoing messages to the module -->
                                            <wsdl>${basedir}/src/main/resources/contract/${wsdl.contract.name}.wsdl</wsdl>
                                            <bindingFiles>
                                                <bindingFile>${basedir}/src/main/resources/binding.xml</bindingFile>
                                            </bindingFiles>
                                        </wsdlOption>
                                    </wsdlOptions>
                                </configuration>
                                <goals>
                                    <goal>wsdl2java</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    
    <build>
        <finalName>${project.name}-${project.parent.version}</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ejb-plugin</artifactId>
                <configuration>
                    <ejbVersion>3.1</ejbVersion>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>
