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

    <parent>
        <groupId>org.apache.ws.commons.axiom</groupId>
        <artifactId>testing</artifactId>
        <version>2.0.0</version>
    </parent>

    <artifactId>jaxp-testsuite</artifactId>

    <url>http://ws.apache.org/axiom/</url>

    <properties>
        <xalan.version>2.7.3</xalan.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.sun.xml.stream</groupId>
                <artifactId>sjsxp</artifactId>
                <version>1.0.2</version>
            </dependency>
            <dependency>
                <groupId>stax</groupId>
                <artifactId>stax</artifactId>
                <version>1.2.0</version>
            </dependency>
        </dependencies>        
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>multiton</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>
        <dependency>
            <groupId>org.codehaus.woodstox</groupId>
            <artifactId>stax2-api</artifactId>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
            <version>${xalan.version}</version>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>serializer</artifactId>
            <version>${xalan.version}</version>
        </dependency>
        <dependency>
            <groupId>net.sf.saxon</groupId>
            <artifactId>Saxon-HE</artifactId>
            <version>9.9.1-8</version>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.google.truth</groupId>
            <artifactId>truth</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>${project.build.directory}/generated-resources</directory>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>com.github.veithen.alta</groupId>
                <!-- We don't use maven-dependency-plugin here because Dependabot would try to update
                     all the Woodstox versions to the most recent one, but we explicitly want older
                     versions. -->
                <artifactId>alta-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-stax-jars</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactSet>
                                <artifacts>
                                    <artifact>
                                        <groupId>org.codehaus.woodstox</groupId>
                                        <artifactId>woodstox-core-asl</artifactId>
                                        <version>4.4.1</version>
                                    </artifact>
                                    <artifact>
                                        <groupId>com.fasterxml.woodstox</groupId>
                                        <artifactId>woodstox-core</artifactId>
                                        <version>5.3.0</version>
                                    </artifact>
                                    <artifact>
                                        <groupId>com.fasterxml.woodstox</groupId>
                                        <artifactId>woodstox-core</artifactId>
                                        <version>6.7.0</version>
                                    </artifact>
                                    <artifact>
                                        <groupId>com.fasterxml.woodstox</groupId>
                                        <artifactId>woodstox-core</artifactId>
                                    </artifact>
                                    <artifact>
                                        <groupId>com.sun.xml.stream</groupId>
                                        <artifactId>sjsxp</artifactId>
                                    </artifact>
                                    <artifact>
                                        <groupId>stax</groupId>
                                        <artifactId>stax</artifactId>
                                    </artifact>
                                </artifacts>
                            </artifactSet>
                            <outputDirectory>${project.build.directory}/generated-resources/org/apache/axiom/ts/jaxp/stax</outputDirectory>
                            <name>%artifactId%-%version%.%type%</name>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.gmavenplus</groupId>
                <artifactId>gmavenplus-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <scripts>
                                <script><![CDATA[
                                    def dir = new File(project.build.directory, "generated-resources/org/apache/axiom/ts/jaxp/stax");
                                    def filelist = new File(dir, "filelist");
                                    filelist.delete();
                                    def files = dir.listFiles({ File f -> f.file && f.name.endsWith(".jar") } as FileFilter)
                                    files.sort()
                                    files.each({ filelist.append("$it.name\n") })
                                ]]></script>
                            </scripts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
