<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements. See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership. The ASF licenses this file
  ~ to you under the Apache License, Version 2.0 (the
  ~ "License"); you may not use this file except in compliance
  ~ with the License. You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied. See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.apache.axis2</groupId>
        <artifactId>axis2-parent</artifactId>
        <version>1.4.1</version>
        <relativePath>../parent/pom.xml</relativePath>
    </parent>
    <artifactId>axis2-fastinfoset</artifactId>
    <name>Apache Axis2 - Fast Infoset</name>
    <description>Axis2 Fast Infoset module</description>
    <dependencies>
        <dependency>
            <groupId>com.sun.xml.fastinfoset</groupId>
            <artifactId>FastInfoset</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-kernel</artifactId>
            <version>${version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-adb</artifactId>
            <version>${version}</version>
        </dependency>
        <dependency>
            <groupId>wsdl4j</groupId>
            <artifactId>wsdl4j</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.commons.schema</groupId>
            <artifactId>XmlSchema</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-java2wsdl</artifactId>
            <version>${version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-adb-codegen</artifactId>
            <version>${version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-codegen</artifactId>
            <version>${version}</version>
        </dependency>
        <dependency>
            <groupId>annogen</groupId>
            <artifactId>annogen</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
        </dependency>
        <dependency>
            <groupId>backport-util-concurrent</groupId>
            <artifactId>backport-util-concurrent</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.neethi</groupId>
            <artifactId>neethi</artifactId>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>java14</id>
            <activation>
                <jdk>1.4</jdk>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.sun.xml.fastinfoset</groupId>
                    <artifactId>FastInfoset</artifactId>
                    <version>${fi.version}</version>
                </dependency>
                <dependency>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                    <version>${junit.version-jdk1.4}</version>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <testSourceDirectory>test</testSourceDirectory>
        <resources>
            <resource>
                <directory>../..</directory>
                <includes>
                    <include>NOTICE.txt</include>
                    <include>LICENSE.txt</include>
                </includes>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>conf</directory>
                <includes>
                    <include>**/*.properties</include>
                </includes>
            </resource>
            <resource>
                <directory>src</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>resources</directory>
                <includes>
                    <include>**/*</include>
                </includes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>test</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.wsdl</include>
                    <include>**/*.properties</include>
                </includes>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <inherited>true</inherited>
                <configuration>
                    <source>1.4</source>
                    <target>1.4</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>gen-ts</id>
                        <phase>generate-test-sources</phase>
                        <configuration>
                            <tasks>
                                <!-- Set a property that can be picked up from the ant build.xml's -->
                                <property name="maven.class.path" refid="maven.runtime.classpath"/>
                                <property name="maven.test.path" refid="maven.compile.classpath"/>
                                <!-- copy the mars so that they are available on the test classpath -->
                                <copy file="../addressing/target/addressing-${version}.mar"
                                      tofile="target/test-classes/modules/addressing-${version}.mar"/>

                                <property name="axis2.home" value="${basedir}/target"/>
                                <path id="maven.dependency.classpath">
                                    <path refid="maven.compile.classpath"/>
                                </path>
                                <!-- compiling some custom wsdl files -->
                                <property name="wsdl.source.dir" value="test-resources/wsdl"/>
                                <property name="wsdl.output.base.dir" value="target/wsdl"/>
                                <!-- make the dirs -->
                                <mkdir dir="${wsdl.output.base.dir}"/>
                                <echo>Compiling Service class</echo>
                                <javac fork="true" destdir="target/test-classes" debug="on">
                                    <classpath refid="maven.dependency.classpath"/>
                                    <classpath location="${compiled.classes.dir}"/>
                                    <include name="**/*SimpleAddService.java"/>
                                    <src path="test/"/>
                                </javac>
                                <echo>Generating the WSDL</echo>
                                <java classname="org.apache.ws.java2wsdl.Java2WSDL" fork="true">
                                    <classpath>
                                        <path refid="maven.dependency.classpath"/>
                                        <pathelement location="target/test-classes"/>
                                    </classpath>
                                    <arg line="-o target/test-classes -of SimpleAddService.wsdl -efd unqualified -cn org.apache.axis2.fastinfoset.SimpleAddService"/>
                                </java>

                                <echo>Compiling SimpleAddService.wsdl</echo>
                                <mkdir dir="${wsdl.output.base.dir}/simpleAddService"/>

                                <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
                                    <classpath refid="maven.runtime.classpath"/>
                                    <classpath location="${compiled.classes.dir}"/>
                                    <arg line="-uri target/test-classes/SimpleAddService.wsdl -o target/wsdl/simpleAddService -S . -or"/>
                                </java>
                                <javac fork="true" destdir="target/classes" debug="on">
                                    <classpath refid="maven.runtime.classpath"/>
                                    <classpath location="${compiled.classes.dir}"/>
                                    <src path="target/wsdl/simpleAddService"/>
                                </javac>

                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <inherited>true</inherited>
                <configuration>
                    <skip>false</skip>

                    <!-- The pertest forkMode is not ideal but seems to be necessary
                         because the test server doesn't shut down properly :-(
                         Should be removed if possible -->
                    <forkMode>pertest</forkMode>
                    <argLine>-Xms256m -Xmx512m</argLine>
                    <!-- Enable the next 2 lines if you want to attach a debugger
                   <argLine>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006</argLine>-->
                    <includes>
                        <include>**/*Test.java</include>
                    </includes>
                    <systemProperties>
                        <property>
                            <name>build.repository</name>
                            <value>./target/test-classes</value>
                        </property>
                    </systemProperties>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
