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

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

    <artifactId>dom-testsuite</artifactId>

    <name>DOM Test Suite</name>
    <description>
        DOM test suite. This test suite can be applied to any DOM implementation. It is validated against Apache Xerces.
    </description>
    <url>http://ws.apache.org/axiom/</url>

    <properties>
        <aspectj.version>1.9.9.1</aspectj.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>xml-truth</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>testutils</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>xml-testsuite</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${aspectj.version}</version>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>jaxp-testsuite</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>jakarta.activation</groupId>
            <artifactId>jakarta.activation-api</artifactId>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>${project.build.directory}/w3c/resources</directory>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.apache.maven.plugins</groupId>
                                        <artifactId>maven-antrun-plugin</artifactId>
                                        <versionRange>[0,)</versionRange>
                                        <goals>
                                            <goal>run</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>extract-domts-sources</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <unzip dest="${project.build.directory}/w3c/java">
                                    <fileset dir="src/w3c">
                                        <include name="*.jar" />
                                    </fileset>
                                    <patternset>
                                        <include name="org/w3c/domts/DocumentBuilderSetting.java" />
                                        <include name="org/w3c/domts/DocumentBuilderSettingStrategy.java" />
                                        <include name="org/w3c/domts/DOMErrorImpl.java" />
                                        <include name="org/w3c/domts/DOMErrorMonitor.java" />
                                        <include name="org/w3c/domts/DOMLocatorImpl.java" />
                                        <include name="org/w3c/domts/DOMTest.java" />
                                        <include name="org/w3c/domts/DOMTestCase.java" />
                                        <include name="org/w3c/domts/DOMTestDocumentBuilderFactory.java" />
                                        <include name="org/w3c/domts/DOMTestFramework.java" />
                                        <include name="org/w3c/domts/DOMTestIncompatibleException.java" />
                                        <include name="org/w3c/domts/DOMTestInnerClass.java" />
                                        <include name="org/w3c/domts/DOMTestSink.java" />
                                        <include name="org/w3c/domts/DOMTestSuite.java" />
                                        <include name="org/w3c/domts/UserDataMonitor.java" />
                                        <include name="org/w3c/domts/UserDataNotification.java" />
                                        <include name="org/w3c/domts/level?/core/*.java" />
                                        <exclude name="org/w3c/domts/**/Test*.java" />
                                    </patternset>
                                </unzip>
                            </target>
                        </configuration>
                    </execution>
                    <execution>
                        <id>extract-domts-resources</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <unzip src="src/w3c/dom1-core-tests-20040405.jar" dest="${project.build.directory}/w3c/resources/org/w3c/domts/level1/core">
                                    <patternset>
                                        <include name="*.xml" />
                                        <exclude name="build.xml" />
                                        <include name="*.dtd" />
                                    </patternset>
                                </unzip>
                                <unzip src="src/w3c/dom2-core-tests-20040405.jar" dest="${project.build.directory}/w3c/resources/org/w3c/domts/level2/core">
                                    <patternset>
                                        <include name="*.xml" />
                                        <exclude name="build.xml" />
                                        <include name="*.dtd" />
                                    </patternset>
                                </unzip>
                                <unzip src="src/w3c/dom3-core-tests-20040405.jar" dest="${project.build.directory}/w3c/resources/org/w3c/domts/level3/core">
                                    <patternset>
                                        <include name="*.xml" />
                                        <exclude name="build.xml" />
                                        <include name="*.dtd" />
                                        <include name="*.xsd" />
                                        <include name="*.js" />
                                        <include name="*.ent" />
                                    </patternset>
                                </unzip>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/w3c/java</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <phase>none</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>aspectj-maven-plugin</artifactId>
                <version>1.14.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <complianceLevel>${javaVersion}</complianceLevel>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjrt</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.aspectj</groupId>
                        <artifactId>aspectjtools</artifactId>
                        <version>${aspectj.version}</version>
                    </dependency>
                    <dependency><!-- Dirty hack to work around Java 9 incompatibility in the plugin -->
                        <groupId>com.sun</groupId>
                        <artifactId>tools</artifactId>
                        <version>${java.version}</version>
                        <scope>system</scope>
                        <systemPath>${project.basedir}/pom.xml</systemPath>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>apache-release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.rat</groupId>
                        <artifactId>apache-rat-plugin</artifactId>
                        <configuration>
                            <excludes>
                                <!-- src/main/resources contains test files and they obviously cannot
                                     all contain a valid license header -->
                                <exclude>src/main/resources/**</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
