<?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.sling</groupId>
        <artifactId>sling</artifactId>
        <version>62</version>
        <relativePath />
    </parent>

    <artifactId>sling-maven-plugin</artifactId>
    <version>3.0.4</version>
    <packaging>maven-plugin</packaging>

    <name>Apache Sling Maven Plugin</name>
    <description>Apache Sling Maven Plugin for Supporting Bundle Development</description>
    <url>https://sling.apache.org/components/sling-maven-plugin/</url>

    <prerequisites>
        <maven>${mavenVersion}</maven>
    </prerequisites>

    <scm>
        <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-maven-plugin.git</connection>
        <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-maven-plugin.git</developerConnection>
        <tag>sling-maven-plugin-3.0.4</tag>
        <url>https://github.com/apache/sling-maven-plugin/tree/${project.scm.tag}</url>
    </scm>

    <properties>
        <maven.site.path>${project.artifactId}-archives/${project.artifactId}-LATEST</maven.site.path>
        <github.project.id>apache/sling-maven-plugin</github.project.id>
        <sling.java.version>11</sling.java.version>
        <mavenVersion>3.8.1</mavenVersion>
        <!-- minimum target Maven version this plugin is compatible with -->
        <maven.compiler.target>${sling.java.version}</maven.compiler.target>
        <starter-its.startTimeoutSeconds>180</starter-its.startTimeoutSeconds>
        <!-- the time in seconds to wait for Sling Starter Feature to be started for the ITs -->
        <project.build.outputTimestamp>1741166935</project.build.outputTimestamp>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.httpcomponents.client5</groupId>
            <artifactId>httpclient5</artifactId>
            <version>5.1.4</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.17.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.18.0</version>
            <scope>compile</scope>
        </dependency>
        <!-- just for JsonTicksConverter -->
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.jcr.contentparser</artifactId>
            <version>1.2.8</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- only for WorkspaceFilter and Constants -->
        <dependency>
            <groupId>org.apache.jackrabbit.vault</groupId>
            <artifactId>org.apache.jackrabbit.vault</artifactId>
            <version>3.8.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.json</groupId>
            <artifactId>jakarta.json-api</artifactId>
            <version>2.1.3</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.johnzon</groupId>
            <artifactId>johnzon-core</artifactId>
            <version>2.0.1</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.jcr</groupId>
            <artifactId>jcr</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.framework</artifactId>
            <version>1.10.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.commons.osgi</artifactId>
            <version>2.4.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${mavenVersion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${mavenVersion}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
            <version>${mavenVersion}</version>
            <scope>provided</scope>
        </dependency>
        <!-- used for evaluating Adapter annotations -->
        <dependency>
            <groupId>io.github.classgraph</groupId>
            <artifactId>classgraph</artifactId>
            <version>4.8.179</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>adapter-annotations</artifactId>
            <version>1.0.0</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.sonatype.plexus</groupId>
            <artifactId>plexus-build-api</artifactId>
            <version>0.0.7</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-descriptor</id>
                        <phase>process-classes</phase>
                    </execution>
                    <execution>
                        <id>help-goal</id>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-scm-publish-plugin</artifactId>
                <configuration>
                    <checkoutDirectory>${user.home}/maven-sites/${maven.site.path}</checkoutDirectory>
                    <tryUpdate>true</tryUpdate>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.rat</groupId>
                <artifactId>apache-rat-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>src/site/markdown/**</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <!-- reserve network ports for the integration tests -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>reserve-network-port</id>
                        <goals>
                            <goal>reserve-network-port</goal>
                        </goals>
                        <phase>pre-integration-test</phase>
                        <configuration>
                            <portNames>
                                <portName>starter-its.http.port</portName>
                            </portNames>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- launch the Sling instances to test; only oak-tar -->
            <plugin>
                <groupId>org.apache.sling</groupId>
                <artifactId>feature-launcher-maven-plugin</artifactId>
                <version>0.1.2</version>
                <configuration>
                    <!-- newer versions don't work due to https://issues.apache.org/jira/browse/SLING-11158 -->
                    <featureLauncherVersion>1.1.26</featureLauncherVersion>
                    <launches>
                        <launch>
                            <id>sling-starter-oak-tar</id>
                            <!-- launch the regular Starter distribution (based on Oak with Segment Node Store) -->
                            <feature>
                                <groupId>org.apache.sling</groupId>
                                <artifactId>org.apache.sling.starter</artifactId>
                                <version>12</version>
                                <classifier>oak_tar</classifier>
                                <type>slingosgifeature</type>
                            </feature>
                            <launcherArguments>
                                <frameworkProperties>
                                    <org.osgi.service.http.port>${starter-its.http.port}</org.osgi.service.http.port>
                                </frameworkProperties>
                            </launcherArguments>
                            <startTimeoutSeconds>${starter-its.startTimeoutSeconds}</startTimeoutSeconds>
                        </launch>
                    </launches>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>start</goal>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-invoker-plugin</artifactId>
                <configuration>
                    <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                    <pomIncludes>
                        <pomInclude>**/pom.xml</pomInclude>
                    </pomIncludes>
                    <postBuildHookScript>verify</postBuildHookScript>
                    <!-- <localRepositoryPath>${project.build.directory}/it-repo</localRepositoryPath>  -->
                    <properties>
                        <sling.url>http://localhost:${starter-its.http.port}</sling.url>
                    </properties>
                    <streamLogsOnFailures>true</streamLogsOnFailures>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>install</goal>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <!-- No javadocs -->
                    <excludePackageNames>org.apache.sling</excludePackageNames>
                </configuration>
            </plugin>
        </plugins>
    </reporting>

    <profiles>
        <profile>
            <!-- extend jacoco profile as long as https://issues.apache.org/jira/browse/SLING-11529 is not fixed -->
            <id>jacoco-report</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-invoker-plugin</artifactId>
                            <configuration>
                                <mavenOpts>${jacoco.command}</mavenOpts>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
        <!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
        <profile>
            <id>only-eclipse</id>
            <activation>
                <property>
                    <name>m2e.version</name>
                </property>
            </activation>
            <build>
                <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-plugin-plugin</artifactId>
                                                <versionRange>[3.4,)</versionRange>
                                                <goals>
                                                    <goal>descriptor</goal>
                                                    <goal>helpmojo</goal>
                                                </goals>
                                            </pluginExecutionFilter>
                                            <action>
                                                <ignore />
                                            </action>
                                        </pluginExecution>
                                    </pluginExecutions>
                                </lifecycleMappingMetadata>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>
</project>
