<?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">

    <parent>
        <artifactId>nifi-stateless</artifactId>
        <groupId>org.apache.nifi</groupId>
        <version>1.15.3</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>nifi-stateless-assembly</artifactId>
    <description>An assembly for building NiFi Stateless</description>
    <packaging>pom</packaging>

    <dependencies>
        <!-- NiFi Stateless specific dependencies -->
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-stateless-api</artifactId>
            <version>1.15.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-stateless-bootstrap</artifactId>
            <version>1.15.3</version>
        </dependency>

        <!-- dependencies shared with NiFi -->
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-api</artifactId>
            <version>1.15.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-framework-api</artifactId>
            <version>1.15.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-server-api</artifactId>
            <version>1.15.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-runtime</artifactId>
            <version>1.15.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-stateless-resources</artifactId>
            <classifier>resources</classifier>
            <version>1.15.3</version>
            <scope>runtime</scope>
            <type>zip</type>
        </dependency>

        <!-- 3rd party dependencies in rootlib directory -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty.toolchain</groupId>
            <artifactId>jetty-schemas</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <scope>compile</scope>
        </dependency>

        <!-- NAR files to include -->
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-jetty-bundle</artifactId>
            <version>1.15.3</version>
            <type>nar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.nifi</groupId>
            <artifactId>nifi-stateless-nar</artifactId>
            <version>1.15.3</version>
            <type>nar</type>
        </dependency>

        <!-- dependencies for jaxb/activation/annotation for running NiFi on Java 11 -->
        <!-- TODO: remove these once minimum Java version is 11 -->
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <version>${jakarta.xml.bind-api.version}</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
            <version>${jaxb.runtime.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>

        <!-- AspectJ library needed by the Java Agent used for native library loading -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjweaver</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <finalName>nifi-stateless-${project.version}</finalName>
                    <attach>false</attach>
                </configuration>
                <executions>
                    <execution>
                        <id>make shared resource</id>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <archiverConfig>
                                <defaultDirectoryMode>0775</defaultDirectoryMode>
                                <directoryMode>0775</directoryMode>
                                <fileMode>0664</fileMode>
                            </archiverConfig>
                            <descriptors>
                                <descriptor>src/main/assembly/dependencies.xml</descriptor>
                            </descriptors>
                            <tarLongFileMode>posix</tarLongFileMode>
                            <formats>
                                <format>dir</format>
                                <format>tar.gz</format>
                            </formats>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>


    <profiles>
        <profile>
            <id>avoid-archive-formats</id>
            <activation>
                <property>
                    <name>dir-only</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <finalName>nifi-stateless-${project.version}</finalName>
                            <attach>false</attach>
                        </configuration>
                        <executions>
                            <execution>
                                <id>make shared resource</id>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <phase>package</phase>
                                <configuration>
                                    <archiverConfig>
                                        <defaultDirectoryMode>0775</defaultDirectoryMode>
                                        <directoryMode>0775</directoryMode>
                                        <fileMode>0664</fileMode>
                                    </archiverConfig>
                                    <descriptors>
                                        <descriptor>src/main/assembly/dependencies.xml</descriptor>
                                    </descriptors>
                                    <tarLongFileMode>posix</tarLongFileMode>
                                    <formats>
                                        <format>dir</format>
                                    </formats>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>