<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright (c) 2024 Alibaba Group Holding Ltd.

 Licensed 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>

    <groupId>com.alibaba.fluss</groupId>
    <artifactId>fluss-shaded</artifactId>
    <version>2.2</version>

    <name>fluss-shaded</name>
    <packaging>pom</packaging>
    <url>https://code.alibaba-inc.com/fluss/fluss</url>
    <inceptionYear>2023</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/alibaba/fluss</url>
    </scm>


    <developers>
        <developer>
            <id>jark</id>
            <name>Jark Wu</name>
            <email>jark@apache.org</email>
        </developer>
    </developers>

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

    <properties>
        <shading.prefix>com.alibaba.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>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>-->
<!--                                            &lt;!&ndash; maven version must be lower than 3.3. See FLINK-3158 &ndash;&gt;-->
<!--                                            <version>(,3.3)</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.2.1</version>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>

    <build>
        <pluginManagement>
            <plugins>
                <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://oss.sonatype.org/</nexusUrl>
                    </configuration>
                </plugin>

                <!-- Javadoc and Sources Attachments -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.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>2.9.1</version>
                    <executions>
                        <execution>
                            <id>attach-javadocs</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>empty-javadoc-jar</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                            <configuration>
                                <classifier>javadoc</classifier>
                                <classesDirectory>${basedir}/javadoc</classesDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

                <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>Fluss-shaded</projectName>
                                <encoding>UTF-8</encoding>
                            </transformer>
                        </transformers>
                        <!-- Flink doesn't publish shaded sources, see https://github.com/apache/flink-shaded/issues/25 -->
                        <createSourcesJar>true</createSourcesJar>
                        <shadeSourcesContent>true</shadeSourcesContent>
                    </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:
                            Copyright (c) 2024 Alibaba Group Holding Ltd.

                            Licensed 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>Copyright (c) 2024 Alibaba Group Holding Ltd
                                </pattern>
                            </patterns>
                        </license>
                    </licenses>
                    <licenseFamilies>
                        <licenseFamily implementation="org.apache.rat.license.SimpleLicenseFamily">
                            <familyName>Apache License 2.0</familyName>
                        </licenseFamily>
                    </licenseFamilies>
                    <excludes>
                        <exclude>**/.*/**</exclude>
                        <exclude>**/LICENSE*</exclude>
                        <exclude>**/NOTICE*</exclude>
                        <exclude>**/README.md</exclude>
                        <exclude>**/*.properties</exclude>
                        <!-- 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.flink.tools.ci.licensecheck.LicenseChecker</mainClass>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <includePluginDependencies>true</includePluginDependencies>
                    <includeProjectDependencies>false</includeProjectDependencies>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.flink</groupId>
                        <artifactId>flink-ci-tools</artifactId>
                        <version>1.18.0</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

</project>
