<?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</groupId>
        <artifactId>apache</artifactId>
        <version>23</version>
    </parent>

    <groupId>org.apache.fluss</groupId>
    <artifactId>fluss-shaded</artifactId>
    <version>1.0-incubating</version>

    <name>fluss-shaded</name>
    <packaging>pom</packaging>
    <url>https://fluss.apache.org/</url>
    <inceptionYear>2025</inceptionYear>

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

    <description>Fluss is a Flink Unified Streaming Storage.</description>

    <scm>
        <url>https://github.com/apache/fluss-shaded</url>
        <connection>git@github.com:apache/fluss-shaded.git</connection>
        <developerConnection>scm:git:https://github.com/apache/fluss-shaded.git</developerConnection>
    </scm>

    <pluginRepositories>
        <pluginRepository>
            <!-- Allows exec-maven-plugin to resolve snapshot plugin dependencies -->
            <id>apache.snapshots.https</id>
            <name>${distMgmtSnapshotsName}</name>
            <url>${distMgmtSnapshotsUrl}</url>
        </pluginRepository>
    </pluginRepositories>

    <properties>
        <shading.prefix>org.apache.fluss.shaded</shading.prefix>
        <netty.version>4.1.104.Final</netty.version>
        <jackson.version>2.15.3</jackson.version>
        <guava.version>32.1.3-jre</guava.version>
        <!-- The license check requires the artifactId to match the directory that the module resides in.
     This is not the case for several modules in fluss-shaded for legacy reasons.
     This property can be used by modules to add a suffix to the artifactId to match the directory name on CI
     when the 'license-check' profile is active. -->
        <fluss.ci.license.suffix/>
    </properties>

    <modules>
        <module>tools/ci/fluss-shaded-ci-tools</module>
        <module>fluss-shaded-guava-32</module>
        <module>fluss-shaded-netty-4</module>
        <module>fluss-shaded-jackson-parent</module>
        <module>fluss-shaded-zookeeper-parent</module>
        <module>fluss-shaded-arrow-parent</module>
    </modules>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.4</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>enforce-maven</id>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                        <requireJavaVersion>
                                            <version>1.8.0</version>
                                        </requireJavaVersion>
                                        <requireMavenVersion>
                                            <!-- Maven version for releasing should match
                                            the Maven version used in CI (and Fluss's main repo) -->
                                            <version>[3.8.6]</version>
                                        </requireMavenVersion>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>java11</id>
            <activation>
                <jdk>11</jdk>
            </activation>

            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-shade-plugin</artifactId>
                            <version>3.6.0</version>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
        <profile>
            <id>shade-sources</id>
            <activation>
                <property>
                    <name>shade-sources</name>
                </property>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-shade-plugin</artifactId>
                            <configuration combine.children="append">
                                <createSourcesJar>true</createSourcesJar>
                                <shadeSourcesContent>true</shadeSourcesContent>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-shade-plugin</artifactId>
                    <version>3.2.0</version>
                    <configuration>
                        <filters combine.children="append">
                            <filter>
                                <artifact>*</artifact>
                                <excludes>
                                    <exclude>META-INF/maven/**</exclude>
                                </excludes>
                            </filter>
                        </filters>
                        <transformers>
                            <!-- The service transformer is needed to merge META-INF/services files -->
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
                            <!-- The ApacheNoticeResourceTransformer collects and aggregates NOTICE files -->
                            <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
                                <projectName>Apache Fluss Shaded</projectName>
                                <encoding>UTF-8</encoding>
                            </transformer>
                        </transformers>
                    </configuration>
                </plugin>

                <plugin>
                    <!-- Used to resolve variables in the 'version' tag -->
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>flatten-maven-plugin</artifactId>
                    <version>1.2.7</version>
                    <executions>
                        <execution>
                            <id>flatten</id>
                            <phase>package</phase>
                            <goals>
                                <goal>flatten</goal>
                            </goals>
                            <configuration>
                                <!-- The least invasive mode that effectively only resolves variables -->
                                <flattenMode>resolveCiFriendliesOnly</flattenMode>
                                <!-- By default the resulting pom is written into the modules base directory to work around MNG-6405.
                                    We aren't affected, so we use the proper location. -->
                                <outputDirectory>${project.build.directory}</outputDirectory>
                            </configuration>
                        </execution>
                        <execution>
                            <id>flatten.clean</id>
                            <phase>clean</phase>
                            <goals>
                                <goal>clean</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>dependency-convergence</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <dependencyConvergence/>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.rat</groupId>
                <artifactId>apache-rat-plugin</artifactId>
                <version>0.11</version><!--$NO-MVN-MAN-VER$-->
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <excludeSubProjects>false</excludeSubProjects>
                    <numUnapprovedLicenses>0</numUnapprovedLicenses>
                    <licenses>
                        <!-- Enforce this license:
                            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.
                        -->
                        <license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense">
                            <licenseFamilyCategory>AL2</licenseFamilyCategory>
                            <licenseFamilyName>Apache License 2.0</licenseFamilyName>
                            <notes/>
                            <patterns>
                                <pattern>Licensed to the Apache Software Foundation (ASF) under one</pattern>
                            </patterns>
                        </license>
                    </licenses>
                    <licenseFamilies>
                        <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily">
                            <familyName>Apache License 2.0</familyName>
                        </licenseFamily>
                    </licenseFamilies>
                    <excludes>
                        <!-- GitHub infrastructure -->
                        <exclude>.asf.yaml</exclude>
                        <exclude>.github/**</exclude>
                        <!-- Build files -->
                        <exclude>**/*.iml</exclude>
                        <!-- Generated content -->
                        <exclude>**/target/**</exclude>
                        <!-- the licenses that are re-bundled -->
                        <exclude>**/licenses/LICENSE.*</exclude>
                        <!-- release files -->
                        <exclude>**/release/**</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.1.0</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>check-license</id>
                        <!-- manually called -->
                        <phase>none</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>org.apache.fluss.shaded.tools.ci.licensecheck.LicenseChecker</mainClass>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <includePluginDependencies>true</includePluginDependencies>
                    <includeProjectDependencies>false</includeProjectDependencies>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.fluss</groupId>
                        <artifactId>fluss-shaded-ci-tools</artifactId>
                        <version>1.0-incubating</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

</project>
