<?xml version="1.0" encoding="UTF-8"?>
<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>
    <groupId>be.orbinson.aem</groupId>
    <artifactId>aem-groovy-console</artifactId>
    <packaging>pom</packaging>
    <version>18.0.2</version>
    <name>AEM Groovy Console</name>
    <description>
        The AEM Groovy Console provides an interface for running Groovy scripts in the AEM container. Scripts can be
        created to manipulate content in the JCR, call OSGi services, or execute arbitrary code using the AEM, Sling,
        or JCR APIs.
    </description>

    <modules>
        <module>all</module>
        <module>api</module>
        <module>bundle</module>
        <module>ui.apps</module>
        <module>ui.apps.structure</module>
        <module>ui.config</module>
        <module>ui.content</module>
    </modules>

    <url>https://github.com/orbinson/aem-groovy-console</url>

    <developers>
        <developer>
            <name>Mark Daugherty</name>
            <email>mark.r.daugherty@gmail.com</email>
            <id>markdaugherty</id>
        </developer>
        <developer>
            <name>Barry d'Hoine</name>
            <email>barrydhoine@gmail.com</email>
            <id>bdhoine</id>
        </developer>
        <developer>
            <name>Roy Teeuwen</name>
            <email>roy@orbinson.be</email>
            <id>royteeuwen</id>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <scm>
        <connection>scm:git:git@github.com:orbinson/aem-groovy-console.git</connection>
        <developerConnection>scm:git:git@github.com:orbinson/aem-groovy-console.git</developerConnection>
        <url>https://github.com/orbinson/aem-groovy-console</url>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/orbinson/aem-groovy-console/issues</url>
    </issueManagement>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <name>Central Repository OSSRH - Snapshots</name>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <name>Central Repository OSSRH</name>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <properties>
        <!-- maven -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss.SSSZ</maven.build.timestamp.format>
        <timestamp>${maven.build.timestamp}</timestamp>

        <!-- AEM -->
        <aem.host>localhost</aem.host>
        <aem.port>4502</aem.port>
        <aem.publish.host>localhost</aem.publish.host>
        <aem.publish.port>4503</aem.publish.port>
        <vault.user>admin</vault.user>
        <vault.password>admin</vault.password>
        <package.group>aem-groovy-console</package.group>

        <bnd.version>6.4.0</bnd.version>
    </properties>

    <profiles>
        <profile>
            <id>on-prem</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <aem.version>6.5.10</aem.version>
            </properties>
            <dependencyManagement>
                <dependencies>
                    <!-- AEM 6.5 -->
                    <dependency>
                        <groupId>com.adobe.aem</groupId>
                        <artifactId>uber-jar</artifactId>
                        <version>${aem.version}</version>
                        <scope>provided</scope>
                    </dependency>
                </dependencies>
            </dependencyManagement>
        </profile>

        <profile>
            <id>cloud</id>
            <properties>
                <aem.version>2022.11.9850.20221116T162329Z-220900</aem.version>
            </properties>
            <dependencyManagement>
                <dependencies>
                    <!-- AEM as a Cloud Service -->
                    <dependency>
                        <groupId>io.wcm.maven</groupId>
                        <artifactId>io.wcm.maven.aem-cloud-dependencies</artifactId>
                        <version>${aem.version}.0000</version>
                        <type>pom</type>
                        <scope>import</scope>
                    </dependency>
                </dependencies>
            </dependencyManagement>
        </profile>

        <profile>
            <id>autoInstallBundle</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.sling</groupId>
                            <artifactId>sling-maven-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>install-bundle</id>
                                    <goals>
                                        <goal>install</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>

        <profile>
            <id>autoInstallBundlePublish</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.sling</groupId>
                            <artifactId>sling-maven-plugin</artifactId>
                            <configuration>
                                <slingUrl>http://${aem.publish.host}:${aem.publish.port}/system/console</slingUrl>
                            </configuration>
                            <executions>
                                <execution>
                                    <id>install-bundle</id>
                                    <goals>
                                        <goal>install</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>

        <profile>
            <id>autoInstallPackage</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.jackrabbit</groupId>
                            <artifactId>filevault-package-maven-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>create-package</id>
                                    <goals>
                                        <goal>package</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                        <plugin>
                            <groupId>io.wcm.maven.plugins</groupId>
                            <artifactId>wcmio-content-package-maven-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>install-package</id>
                                    <goals>
                                        <goal>install</goal>
                                    </goals>
                                    <configuration>
                                        <serviceURL>http://${aem.host}:${aem.port}/crx/packmgr/service.jsp</serviceURL>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>

        <profile>
            <id>autoInstallPackagePublish</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.jackrabbit</groupId>
                            <artifactId>filevault-package-maven-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>create-package</id>
                                    <goals>
                                        <goal>package</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                        <plugin>
                            <groupId>io.wcm.maven.plugins</groupId>
                            <artifactId>wcmio-content-package-maven-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>install-package-publish</id>
                                    <goals>
                                        <goal>install</goal>
                                    </goals>
                                    <configuration>
                                        <serviceURL>
                                            http://${aem.publish.host}:${aem.publish.port}/crx/packmgr/service.jsp
                                        </serviceURL>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <compilerId>groovy-eclipse-compiler</compilerId>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>utf-8</encoding>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-compiler</artifactId>
                        <version>3.4.0-01</version>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-eclipse-batch</artifactId>
                        <version>2.4.17-01</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.6</version>
                <configuration>
                    <!-- Prevent gpg from using pinentry programs -->
                    <gpgArguments>
                        <arg>--pinentry-mode</arg>
                        <arg>loopback</arg>
                    </gpgArguments>
                </configuration>
                <executions>
                    <execution>
                        <phase>deploy</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
                <executions>
                    <execution>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-site-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>3.1.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>3.0.0</version>
                </plugin>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.0.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.8.1</version>
                </plugin>
                <plugin>
                    <groupId>biz.aQute.bnd</groupId>
                    <artifactId>bnd-baseline-maven-plugin</artifactId>
                    <version>${bnd.version}</version>
                    <configuration>
                        <failOnMissing>false</failOnMissing>
                        <diffignores>
                            <!-- ignore Bundle-Version header for baseline, i.e. no enforcement of specific bundle versions -->
                            <diffignore>Bundle-Version</diffignore>
                        </diffignores>
                    </configuration>
                    <executions>
                        <execution>
                            <id>baseline</id>
                            <goals>
                                <goal>baseline</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>biz.aQute.bnd</groupId>
                    <artifactId>bnd-maven-plugin</artifactId>
                    <version>${bnd.version}</version>
                    <executions>
                        <execution>
                            <id>bnd-process</id>
                            <goals>
                                <goal>bnd-process</goal>
                            </goals>
                            <configuration>
                                <bnd><![CDATA[

# export all versioned packages except for conditional ones (https://github.com/bndtools/bnd/issues/3721#issuecomment-579026778)
-exportcontents: ${removeall;${packages;VERSIONED};${packages;CONDITIONAL}}

# reproducible builds (https://github.com/bndtools/bnd/issues/3521)
-noextraheaders: true
-snapshot: SNAPSHOT

-plugin org.apache.sling.bnd.models.ModelsScannerPlugin

                                ]]></bnd>
                            </configuration>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.sling</groupId>
                            <artifactId>org.apache.sling.bnd.models</artifactId>
                            <version>1.0.0</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <plugin>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.5.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.22.1</version>
                    <configuration>
                        <trimStackTrace>false</trimStackTrace>
                        <useSystemClassLoader>false</useSystemClassLoader>
                        <includes>
                            <include>**/*Test*</include>
                        </includes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.2.1</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.4.1</version>
                    <configuration>
                        <source>8</source>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.8.2</version>
                </plugin>
                <plugin>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.12.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.sling</groupId>
                    <artifactId>sling-maven-plugin</artifactId>
                    <version>2.4.0</version>
                    <configuration>
                        <slingUrl>http://${aem.host}:${aem.port}/system/console</slingUrl>
                        <deploymentMethod>WebConsole</deploymentMethod>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.jackrabbit</groupId>
                    <artifactId>filevault-package-maven-plugin</artifactId>
                    <extensions>true</extensions>
                    <version>1.1.4</version>
                    <configuration>
                        <filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
                        <properties>
                            <cloudManagerTarget>none</cloudManagerTarget>
                        </properties>
                        <validatorsSettings>
                            <jackrabbit-nodetypes>
                                <options>
                                    <!-- use the nodetypes and namespaces from the aem-nodetypes.jar provided in the plugin dependencies -->
                                    <cnds>tccl:aem.cnd</cnds>
                                </options>
                            </jackrabbit-nodetypes>
                        </validatorsSettings>
                        <showImportPackageReport>false</showImportPackageReport>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>biz.netcentric.aem</groupId>
                            <artifactId>aem-nodetypes</artifactId>
                            <version>6.5.5.0</version>
                        </dependency>
                    </dependencies>
                </plugin>
                <!-- Content Package Plugin -->
                <plugin>
                    <groupId>io.wcm.maven.plugins</groupId>
                    <artifactId>wcmio-content-package-maven-plugin</artifactId>
                    <version>2.1.2</version>
                    <configuration>
                        <userId>${vault.user}</userId>
                        <password>${vault.password}</password>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>com.adobe.aem</groupId>
                    <artifactId>aemanalyser-maven-plugin</artifactId>
                    <version>1.5.8</version>
                    <extensions>true</extensions>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.6.7</version>
                    <extensions>true</extensions>
                    <configuration>
                        <serverId>ossrh</serverId>
                        <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                        <autoReleaseAfterClose>true</autoReleaseAfterClose>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.jetbrains</groupId>
                <artifactId>annotations</artifactId>
                <version>23.0.0</version>
                <scope>provided</scope>
            </dependency>

            <!-- Groovy -->
            <dependency>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-all</artifactId>
                <version>2.4.15</version>
                <scope>provided</scope>
            </dependency>

            <!-- Testing -->
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>5.8.2</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-inline</artifactId>
                <version>4.1.0</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-junit-jupiter</artifactId>
                <version>4.1.0</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>io.wcm</groupId>
                <artifactId>io.wcm.testing.aem-mock.junit5</artifactId>
                <version>5.1.2</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.sling</groupId>
                <artifactId>org.apache.sling.testing.sling-mock-oak</artifactId>
                <version>3.1.4-1.40.0</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <reporting>
        <plugins>
            <plugin>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.7</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>summary</report>
                            <report>license</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>
</project>
