<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>stream-applications-release-train</artifactId>
        <groupId>org.springframework.cloud.stream.app</groupId>
        <version>2022.0.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>stream-applications-descriptor</artifactId>
    <name>stream-applications-descriptor</name>
    <version>2022.0.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <properties>
        <uniqueVersion>false</uniqueVersion>
    </properties>
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>META-INF/kafka-apps-maven.properties</include>
                    <include>META-INF/rabbit-apps-maven.properties</include>
                    <include>META-INF/kafka-apps-docker.properties</include>
                    <include>META-INF/kafka-apps-harbor.properties</include>
                    <include>META-INF/rabbit-apps-docker.properties</include>
                    <include>META-INF/rabbit-apps-harbor.properties</include>
                    <include>META-INF/kafka-apps-maven-repo-url.properties</include>
                    <include>META-INF/rabbit-apps-maven-repo-url.properties</include>
                </includes>
            </resource>
        </resources>

        <plugins>
            <plugin>
                <groupId>org.codehaus.gmavenplus</groupId>
                <artifactId>gmavenplus-plugin</artifactId>
                <version>2.1.0</version>
                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-all</artifactId>
                        <version>3.0.17</version>
                        <type>pom</type>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>add-boot3</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <properties>
                                <dir>${project.build.directory}/classes</dir>
                            </properties>
                            <bindPropertiesToSeparateVariables>false</bindPropertiesToSeparateVariables>
                            <scripts>
                                <script>file:${project.basedir}/src/main/groovy/add-boot3.groovy</script>
                            </scripts>
                        </configuration>
                    </execution>
                    <execution>
                        <id>validate-repo</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <scripts>
                                <script>
                                    <![CDATA[
                                def repoSpring = "${apps.version}".contains('SNAPSHOT') ? 'repo.spring.io/snapshot' :
                                                "${apps.version}".contains('-') ? 'repo.spring.io/milestone' : 'repo.maven.apache.org/maven2'
                                project.properties.setProperty('repo-spring-io', repoSpring)
                                println('repo-spring-io=$repoSpring')
                                ]]>
                                </script>
                            </scripts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.2</version>
                <configuration>
                    <skip>false</skip>
                    <version>${project.version}</version>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>attach-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>target/classes/META-INF/kafka-apps-maven.properties</file>
                                    <type>stream-apps-kafka-maven</type>
                                </artifact>
                                <artifact>
                                    <file>target/classes/META-INF/kafka-apps-docker.properties</file>
                                    <type>stream-apps-kafka-docker</type>
                                </artifact>
                                <artifact>
                                    <file>target/classes/META-INF/kafka-apps-harbor.properties</file>
                                    <type>stream-apps-kafka-harbor</type>
                                </artifact>
                                <artifact>
                                    <file>target/classes/META-INF/rabbit-apps-maven.properties</file>
                                    <type>stream-apps-rabbit-maven</type>
                                </artifact>
                                <artifact>
                                    <file>target/classes/META-INF/rabbit-apps-docker.properties</file>
                                    <type>stream-apps-rabbit-docker</type>
                                </artifact>
                                <artifact>
                                    <file>target/classes/META-INF/rabbit-apps-harbor.properties</file>
                                    <type>stream-apps-rabbit-harbor</type>
                                </artifact>
                                <artifact>
                                    <file>target/classes/META-INF/kafka-apps-maven-repo-url.properties</file>
                                    <type>kafka-apps-maven-repo-url.properties</type>
                                </artifact>
                                <artifact>
                                    <file>target/classes/META-INF/rabbit-apps-maven-repo-url.properties</file>
                                    <type>rabbit-apps-maven-repo-url.properties</type>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
