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

    <groupId>test-cxf-java2wsdl</groupId>
    <artifactId>test-cxf-java2wsdl</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <cxf.version>2.6.0</cxf.version>
    </properties>

    <build>
         <resources>
              <resource>
                    <directory>${project.build.directory}/generated-sources</directory>
              </resource>
         </resources>
    </build>

    <profiles>
        <profile>
            <id>CXF</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.cxf</groupId>
                        <artifactId>cxf-java2ws-plugin</artifactId>
                        <version>${cxf.version}</version>

                        <executions>
                            <execution>
                                <id>generate-amazing-service-wsdl</id>
                                <phase>process-classes</phase>
                                <configuration>
                                    <className>com.test.AmazingServiceImpl</className>
                                    <serviceName>AmazingService</serviceName>
                                    <genWsdl>true</genWsdl>
                                    <verbose>true</verbose>
                                   
                                    <outputFile>${project.build.directory}/generated-sources/wsdl/AmazingService.wsdl</outputFile>
                                </configuration>
                                <goals>
                                    <goal>java2ws</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.jvnet.jax-ws-commons</groupId>
                        <artifactId>jaxws-maven-plugin</artifactId>
                        <version>2.2</version>
                        <executions>
                            <execution>
                                <id>generate-amazing-client</id>
                                <phase>generate-test-sources</phase>
                                <goals>
                                    <goal>wsimport</goal>
                                </goals>
                                <configuration>
                                    <wsdlFiles>
                                        <wsdlFile>AmazingService.wsdl</wsdlFile>
                                    </wsdlFiles>
                                    <wsdlDirectory>${project.build.directory}/generated-sources/wsdl</wsdlDirectory>
                                    <wsdlLocation>/wsdl/AmazingService.wsdl</wsdlLocation>
                                    <packageName>com.test.ws.client</packageName>
                                    <!--Need to use unique stale file when we have multiply executions-->
                                    <staleFile>${project.build.directory}/jaxws/stale/.staleFlag1</staleFile>
                                </configuration>
                            </execution>
                        </executions>
                        <configuration>
                            <verbose>true</verbose>
                            <extension>true</extension>
                            <target>2.0</target>
                            <xjcArgs>
                                <xjcArg>-XautoNameResolution</xjcArg>
                            </xjcArgs>
                            <sourceDestDir>${project.build.directory}/generated-sources/jax-ws-client</sourceDestDir>
                        </configuration>
                    </plugin>

                </plugins>
            </build>
        </profile>

        <profile>
            <id>METRO</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>


                    <plugin>
                        <groupId>org.jvnet.jax-ws-commons</groupId>
                        <artifactId>jaxws-maven-plugin</artifactId>
                        <version>2.2</version>
                        <executions>
                            <execution>
                                <id>generate-amazing-service-wsdl</id>
                                <goals>
                                    <goal>wsgen</goal>
                                </goals>
                                <phase>process-classes</phase>
                                <configuration>
                                    <sei>com.test.AmazingServiceImpl</sei>
                                    <genWsdl>true</genWsdl>
                                    <keep>true</keep>
                                    <resourceDestDir>${project.build.directory}/generated/wsdl</resourceDestDir>
                                    <inlineSchemas>true</inlineSchemas>
                                </configuration>
                            </execution>
                            <execution>
                                <id>generate-amazing-client</id>
                                <phase>generate-test-sources</phase>
                                <goals>
                                    <goal>wsimport</goal>
                                </goals>
                                <configuration>
                                    <wsdlFiles>
                                        <wsdlFile>AmazingService.wsdl</wsdlFile>
                                    </wsdlFiles>
                                    <wsdlDirectory>${project.build.directory}/generated/wsdl</wsdlDirectory>
                                    <wsdlLocation>/wsdl/AmazingService.wsdl</wsdlLocation>
                                    <packageName>com.test.ws.client</packageName>
                                    <!--Need to use unique stale file when we have multiply executions-->
                                    <staleFile>${project.build.directory}/jaxws/stale/.staleFlag1</staleFile>
                                </configuration>
                            </execution>
                        </executions>
                        <configuration>
                            <verbose>true</verbose>
                            <extension>true</extension>
                            <target>2.0</target>
                            <xjcArgs>
                                <xjcArg>-XautoNameResolution</xjcArg>
                            </xjcArgs>
                            <sourceDestDir>${project.build.directory}/generated-sources/jax-ws-client</sourceDestDir>
                        </configuration>
                    </plugin>

                </plugins>
            </build>
        </profile>

    </profiles>


</project>
