<?xml version="1.0" encoding="ISO-8859-1"?>
    <!--
        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>43</version>
        <relativePath />
    </parent>

    <artifactId>org.apache.sling.feature.launcher</artifactId>
    <version>1.1.20</version>

    <name>Apache Sling Feature Model Launcher</name>
    <description>
        A application launcher using Apache Sling Features
    </description>

    <properties>
        <sling.java.version>8</sling.java.version>
        <bnd.version>5.3.0</bnd.version>
    </properties>

    <scm>
        <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-launcher.git</connection>
        <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-launcher.git</developerConnection>
        <url>https://gitbox.apache.org/repos/asf?p=sling-org-apache-sling-feature-launcher.git</url>
      <tag>org.apache.sling.feature.launcher-1.1.20</tag>
  </scm>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.apache.commons</groupId>
                                    <artifactId>commons-text</artifactId>
                                    <version>1.9</version>
                                    <type>jar</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/classes</outputDirectory>
                                    <includes>
                                        org/apache/commons/text/Builder*,
                                        org/apache/commons/text/StringSubstitutor*,
                                        org/apache/commons/text/StringTokenizer*,
                                        org/apache/commons/text/TextStringBuilder*,
                                        org/apache/commons/text/lookup/StringLookup*,
                                        org/apache/commons/text/matcher/*
                                    </includes>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.apache.commons</groupId>
                                    <artifactId>commons-lang3</artifactId>
                                    <version>3.12.0</version>
                                    <type>jar</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/classes</outputDirectory>
                                    <includes>
                                        org/apache/commons/lang3/ArrayUtils*,
                                        org/apache/commons/lang3/StringUtils*,
                                        org/apache/commons/lang3/Validate*
                                    </includes>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>biz.aQute.bnd</groupId>
                <artifactId>bnd-maven-plugin</artifactId>
                <version>5.3.0</version>
                <configuration>
                    <bnd>
                        <![CDATA[
                            Main-Class: org.apache.sling.feature.launcher.impl.Main
                            -exportcontents:\
                            org.apache.sling.feature.launcher.spi.*
                            -conditionalpackage:\
                            javax.json*,\
                            org.apache.commons.cli.*,\
                            org.apache.felix.cm.json.*,\
                            org.apache.felix.converter.*,\
                            org.apache.johnzon.core.*,\
                            org.apache.johnzon.core.util.*,\
                            org.apache.sling.feature.*,\
                            org.osgi.util.function.*,\
                            org.osgi.util.converter.*,\
                            org.slf4j.*,\
                            org.slf4j.impl.*
                            Import-Package:\
                            !org.osgi.framework.*,\
                            !org.osgi.util.tracker.*,\
                            !org.osgi.resource.*,\
                            *
                        ]]>
                    </bnd>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>bnd-process</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.rat</groupId>
                <artifactId>apache-rat-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>readme.md</exclude>
                        <exclude>src/main/resources/META-INF/services/**</exclude>
                        <exclude>**/*.properties</exclude>
                        <exclude>launcher/**</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <classpathDependencyScopeExclude>compile+runtime</classpathDependencyScopeExclude>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${basedir}</directory>
                            <includes>
                                <include>launcher/**</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>1.9</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.12.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>osgi.core</artifactId>
            <version>7.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.feature</artifactId>
            <version>1.2.24</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.osgi</groupId>
            <artifactId>org.osgi.util.function</artifactId>
            <version>1.0.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.converter</artifactId>
            <version>1.0.18</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.cm.json</artifactId>
            <version>1.0.6</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
             <groupId>commons-cli</groupId>
             <artifactId>commons-cli</artifactId>
             <version>1.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.commons.johnzon</artifactId>
            <version>1.2.6</version>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>biz.aQute.bnd</groupId>
            <artifactId>biz.aQute.bndlib</artifactId>
            <version>${bnd.version}</version>
            <scope>compile</scope>
        </dependency>

        <!-- Testing dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>3.3.3</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
    <profiles>
        <profile>
            <id>container</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <version>0.34.1</version>
                        <configuration>
                            <images>
                                <image>
                                    <name>apache/sling-feature-launcher:${project.version}</name>
                                    <build>
                                        <tags>
                                            <tag>latest</tag>
                                            <tag>${project.version}</tag>
                                        </tags>
                                         <dockerFileDir>.</dockerFileDir>
                                         <assembly>
                                              <descriptorRef>artifact</descriptorRef>
                                         </assembly>
                                    </build>
                                </image>
                            </images>
                        </configuration>
                        <executions>
                            <execution>
                                <id>docker:build</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
