<?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>
        <artifactId>org.apache.sling.cms</artifactId>
        <groupId>org.apache.sling</groupId>
        <version>1.0.2</version>
    </parent>

    <artifactId>org.apache.sling.cms.feature</artifactId>
    <name>Apache Sling - CMS Feature Model</name>

    <properties>
        <sling.java.version>8</sling.java.version>
        <IT.expected.bundles.count>240</IT.expected.bundles.count>
        <bnd.baseline.skip>true</bnd.baseline.skip>
        <run.sling.smoke.test>true</run.sling.smoke.test>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>ianal-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>verify-legal-files</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${basedir}</directory>
                            <includes>
                                <include>sling/**</include>
                                <include>coverage.ec</include>
                                <include>launcher/**</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.sling</groupId>
                <artifactId>slingfeature-maven-plugin</artifactId>
                <version>1.4.24</version>
                <extensions>true</extensions>
                <configuration>
                    <framework>
                        <groupId>org.apache.felix</groupId>
                        <artifactId>org.apache.felix.framework</artifactId>
                        <version>6.0.3</version>
                    </framework>
                    <aggregates>
                        <aggregate>
                            <classifier>slingcms-standalone</classifier>
                            <filesInclude>**/*.json</filesInclude>
                            <filesExclude>oak/node-store/composite-*.json</filesExclude>
                            <filesExclude>runmodes/author.json</filesExclude>
                            <filesExclude>runmodes/renderer.json</filesExclude>
                            <title>Sling CMS - Standalone</title>
                        </aggregate>
                        <aggregate>
                            <classifier>slingcms-author</classifier>
                            <filesInclude>**/*.json</filesInclude>
                            <filesExclude>oak/node-store/composite-*.json</filesExclude>
                            <filesExclude>runmodes/standalone.json</filesExclude>
                            <filesExclude>runmodes/renderer.json</filesExclude>
                            <title>Sling CMS - Author</title>
                        </aggregate>
                        <aggregate>
                            <classifier>slingcms-renderer</classifier>
                            <filesInclude>**/*.json</filesInclude>
                            <filesExclude>oak/node-store/composite-*.json</filesExclude>
                            <filesExclude>runmodes/standalone.json</filesExclude>
                            <filesExclude>runmodes/author.json</filesExclude>
                            <title>Sling CMS - Renderer</title>
                        </aggregate>
                        <aggregate>
                            <classifier>slingcms-composite-seed</classifier>
                            <filesInclude>**/*.json</filesInclude>
                            <filesExclude>oak/node-store/composite-runtime.json</filesExclude>
                            <filesExclude>oak/node-store/segment.json</filesExclude>
                            <filesExclude>runmodes/*.json</filesExclude>
                            <title>Sling CMS - Composite Node Store Seed</title>
                        </aggregate>
                        <aggregate>
                            <classifier>slingcms-composite-runtime</classifier>
                            <filesInclude>**/*.json</filesInclude>
                            <filesExclude>oak/node-store/composite-seed.json</filesExclude>
                            <filesExclude>oak/node-store/segment.json</filesExclude>
                            <filesExclude>runmodes/*.json</filesExclude>
                            <title>Sling CMS - Composite Node Store Runtime</title>
                        </aggregate>
                        <aggregate>
                            <classifier>slingcms-upgrade</classifier>
                            <filesInclude>**/*.json</filesInclude>
                            <filesExclude>framework-properties.json</filesExclude>
                            <filesExclude>oak/node-store/*.json</filesExclude>
                            <filesExclude>runmodes/*.json</filesExclude>
                            <title>Sling CMS - Upgrade</title>
                        </aggregate>
                    </aggregates>
                    <scans>
                        <scan>
                            <includeClassifier>slingcms-composite-runtime</includeClassifier>
                        </scan>
                        <scan>
                            <includeClassifier>slingcms-composite-seed</includeClassifier>
                        </scan>
                        <scan>
                            <includeClassifier>slingcms-standalone</includeClassifier>
                        </scan>
                        <scan>
                            <includeClassifier>slingcms-author</includeClassifier>
                        </scan>
                        <scan>
                            <includeClassifier>slingcms-renderer</includeClassifier>
                        </scan>
                    </scans>
                    <archives>
                        <archive>
                            <classifier>slingcms_standalone_far</classifier>
                            <includeClassifier>slingcms-standalone</includeClassifier>
                        </archive>
                        <archive>
                            <classifier>slingcms_upgrade_far</classifier>
                            <includeClassifier>slingcms-upgrade</includeClassifier>
                        </archive>
                    </archives>
                </configuration>
                <executions>
                    <execution>
                        <id>aggregate-features</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>aggregate-features</goal>
                            <goal>analyse-features</goal>
                            <goal>attach-features</goal>
                            <goal>attach-featurearchives</goal>
                        </goals>
                        <configuration>
                            <replacePropertyVariables>asm-version,org-apache-sling-api-version,org-apache-sling-scripting-jsp-taglib-version,cms-version,composum-version,groovy-version,guava-version,jackrabbit-version,jackson-version,oak-version,slf4j-version,cocoon-serializers-charsets-version,org.apache.felix.webconsole-version,commons-lang3-version,jstl-version,org-apache-sling-models-api-version,org.apache.sling.scripting.jsp.taglib,geronimo-atinject_1-0_spec-version,commons-io-version,tika-version,pdfbox-version,httpclient-version,org-apache-sling-caconfig-api-version,jsoup-version,org-apache-sling-fileoptim-version,org-apache-sling-engine-version,org-apache-sling-commons-johnzon-version,commons-text-version,org-apache-sling-scripting-api-version</replacePropertyVariables>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <finalName>org.apache.sling.cms-${project.version}</finalName>
                    <archive>
                        <manifest>
                            <mainClass>
                                org.apache.sling.cms.feature.Main
                            </mainClass>
                            <classpathPrefix>lib/</classpathPrefix>
                            <addClasspath>true</addClasspath>
                        </manifest>
                    </archive>
                    <descriptors>
                        <descriptor>src/main/assembly/standalone.xml</descriptor>
                    </descriptors>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <arguments>-Drun.sling.smoke.test=false</arguments>
                </configuration>
            </plugin>

        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <!-- Extend RAT configuration from parent pom -->
                    <groupId>org.apache.rat</groupId>
                    <artifactId>apache-rat-plugin</artifactId>
                    <configuration>
                        <excludes combine.children="append">
                            <!-- Exclude sling instance -->
                            <exclude>sling/**</exclude>
                            <exclude>launcher/**</exclude>
                        </excludes>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>run-smoke-test</id>
            <activation>
                <property>
                    <name>run.sling.smoke.test</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <!-- reserve a network port 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>http.port</portName>
                                    </portNames>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.sling</groupId>
                        <artifactId>feature-launcher-maven-plugin</artifactId>
                        <version>0.1.0</version>
                        <configuration>
                            <launches>
                                <launch>
                                    <id>sling-cms</id>
                                    <feature>
                                        <groupId>${project.groupId}</groupId>
                                        <artifactId>${project.artifactId}</artifactId>
                                        <version>${project.version}</version>
                                        <classifier>slingcms-standalone</classifier>
                                        <type>slingosgifeature</type>
                                    </feature>
                                    <launcherArguments>
                                        <frameworkProperties>
                                            <org.osgi.service.http.port>${http.port}</org.osgi.service.http.port>
                                        </frameworkProperties>
                                    </launcherArguments>
                                </launch>
                            </launches>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>start</goal>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <systemPropertyVariables>
                                <sling.http.port>${http.port}</sling.http.port>
                                <IT.expected.bundles.count>${IT.expected.bundles.count}</IT.expected.bundles.count>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient-version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.apache.felix.utils</artifactId>
            <version>1.11.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.sling</groupId>
            <artifactId>org.apache.sling.feature.launcher</artifactId>
            <version>1.1.16</version>
        </dependency>
    </dependencies>
</project>
