<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright (C) 2006-2026 Talend Inc. - www.talend.com
   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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.talend.sdk.component</groupId>
    <artifactId>component-runtime</artifactId>
    <version>1.89.1</version>
  </parent>

  <artifactId>component-runtime-beam</artifactId>

  <name>Component Runtime :: Beam</name>
  <description>Component bridge to BEAM runtime</description>

  <properties>
    <talend.build.name>${talend.build.name.base}.beam</talend.build.name>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.talend.sdk.component</groupId>
      <artifactId>component-runtime-manager</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.talend.sdk.component</groupId>
      <artifactId>component-runtime-design-extension</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.talend.sdk.component</groupId>
      <artifactId>nested-maven-repository</artifactId>
      <version>${project.version}</version>
      <type>pom</type>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.beam</groupId>
      <artifactId>beam-sdks-java-core</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.avro</groupId>
      <artifactId>avro</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.beam</groupId>
      <artifactId>beam-runners-direct-java</artifactId>
      <version>${beam.version}</version>
      <exclusions>
        <exclusion>
          <groupId>joda-time</groupId>
          <artifactId>joda-time</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.beam</groupId>
      <artifactId>beam-runners-spark-3</artifactId>
      <version>${beam.version}</version>
      <scope>test</scope>
      <exclusions>
        <!-- prevent PipelineOptionsFactory to get instantiated if present -->
        <exclusion>
          <groupId>com.fasterxml.jackson.module</groupId>
          <artifactId>jackson-module-scala_${spark-scala.version}</artifactId>
        </exclusion>
        <exclusion>
          <groupId>io.grpc</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-all</artifactId>
      <version>${hamcrest.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.beam</groupId>
      <artifactId>beam-sdks-java-io-jdbc</artifactId>
      <version>${beam.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hsqldb</groupId>
      <artifactId>hsqldb</artifactId>
      <version>2.7.1</version>
      <scope>test</scope>
    </dependency>
    <!-- forbidden to avoid a cycle
    <dependency>
      <groupId>org.talend.sdk.component</groupId>
      <artifactId>component-runtime-junit</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    -->

    <!-- for IT -->
    <dependency>
      <groupId>org.talend.sdk.component</groupId>
      <artifactId>component-runtime-testing-spark</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.talend.sdk.component</groupId>
      <artifactId>sample</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <testResources>
      <testResource>
        <filtering>true</filtering>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-invoker-plugin</artifactId>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>install</goal>
              <goal>run</goal>
            </goals>
            <configuration>
              <streamLogs>true</streamLogs>
              <projectsDirectory>src/it</projectsDirectory>
              <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
              <settingsFile>src/it/settings.xml</settingsFile>
              <profiles>it-repo</profiles>
              <!-- to debug the packaging
              <mavenOpts>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000</mavenOpts>
              -->
              <showErrors>true</showErrors>
              <pomIncludes>
                <pomInclude>*/pom.xml</pomInclude>
              </pomIncludes>
              <goals>
                <goal>clean</goal>
                <goal>install</goal>
              </goals>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>create-TALEND-INF/dependencies.txt</id>
            <goals>
              <goal>list</goal>
            </goals>
            <phase>process-resources</phase>
            <configuration>
              <includeScope>provided</includeScope>
              <outputFile>${project.build.outputDirectory}/TALEND-INF/beam.dependencies</outputFile>
              <excludeArtifactIds>slf4j-api,findbugs-annotations</excludeArtifactIds>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <!-- cleanup asap -->
            <id>cleanup-TALEND-INF/dependencies.txt</id>
            <goals>
              <goal>run</goal>
            </goals>
            <phase>compile</phase>
            <configuration>
              <target>
                <!-- TCOMP-1983 -->
                <replaceregexp byline="true" file="${project.build.outputDirectory}/TALEND-INF/beam.dependencies" match="(\u001B\[36m)?\s+--\s+module\s+.*$" replace="" />
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>dependencies</id>
            <goals>
              <goal>single</goal>
            </goals>
            <phase>package</phase>
            <configuration>
              <attach>true</attach>
              <descriptors>
                <descriptor>src/main/assembly/dependencies.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.gmavenplus</groupId>
        <artifactId>gmavenplus-plugin</artifactId>
        <executions>
          <execution>
            <id>runner-dependencies</id>
            <goals>
              <goal>execute</goal>
            </goals>
            <phase>process-resources</phase>
            <configuration>
              <allowSystemExits>true</allowSystemExits>
              <scripts>
                <script>${project.basedir}/src/main/build/RunnerDependencies.groovy</script>
                <script>${project.basedir}/src/main/build/ClassesIndices.groovy</script>
              </scripts>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-banned-joda-time-dependency</id>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>java11</id>
      <activation>
        <jdk>[11,20)</jdk>
      </activation>
      <properties>
        <!-- requires spark with xbean-asm9 -->
        <invoker.skip>true</invoker.skip>
      </properties>
    </profile>
  </profiles>
</project>
