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

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>top.infra.maven</groupId>
        <artifactId>topinfra-maven</artifactId>
        <version>1.0.0</version>
    </parent>
    <artifactId>topinfra-maven-dist</artifactId>
    <packaging>jar</packaging>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <!--<configuration><classifier>mvn${version.maven}</classifier></configuration>-->
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <classifier>mvn${version.maven}</classifier>
                            <excludes></excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-shade-plugin</artifactId>
                <configuration>
                    <artifactSet>
                        <excludes>
                            <exclude>org.jetbrains:annotations</exclude>
                            <exclude>org.slf4j:*</exclude>
                        </excludes>
                    </artifactSet>
                    <filters>
                        <filter>
                            <!-- Avoid 'Invalid signature file digest for Manifest main attributes' error -->
                            <!-- see: https://maven.apache.org/plugins/maven-jarsigner-plugin/usage.html -->
                            <artifact>*:*</artifact>
                            <excludes>
                                <exclude>META-INF/*.SF</exclude>
                                <exclude>META-INF/*.DSA</exclude>
                                <exclude>META-INF/*.RSA</exclude>
                            </excludes>
                        </filter>
                    </filters>
                    <minimizeJar>false</minimizeJar>
                    <relocations>
                        <relocation>
                            <pattern>org.eclipse.jgit</pattern>
                            <shadedPattern>shaded.org.eclipse.jgit</shadedPattern>
                            <!--<excludes><exclude></exclude></excludes>-->
                        </relocation>
                    </relocations>
                    <shadedArtifactAttached>true</shadedArtifactAttached>
                    <shadedClassifierName>shaded</shadedClassifierName>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals><goal>shade</goal></goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <!-- @formatter:off -->
    <dependencies>
        <dependency><groupId>org.apache.maven</groupId><artifactId>maven-embedder</artifactId><scope>provided</scope></dependency>
        <dependency><groupId>org.apache.maven</groupId><artifactId>maven-model</artifactId><scope>provided</scope></dependency>
    </dependencies>
    <!-- @formatter:on -->

    <!-- @formatter:off -->
    <profiles>
        <profile>
            <id>skip-these-plugins-when-fast-option-present</id>
            <activation><property><name>!fast</name></property></activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.googlecode.maven-download-plugin</groupId>
                        <artifactId>download-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>download-apache-maven</id>
                                <phase>prepare-package</phase>
                                <goals>
                                    <goal>wget</goal>
                                </goals>
                                <configuration>
                                    <url>https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/${version.maven}/apache-maven-${version.maven}-bin.zip</url>
                                    <unpack>true</unpack>
                                    <outputDirectory>${project.basedir}/src/main/assembly/apache-maven</outputDirectory>
                                    <md5>${md5.maven}</md5>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <appendAssemblyId>false</appendAssemblyId>
                                    <descriptors>
                                        <descriptor>src/main/assembly/apache-maven.xml</descriptor>
                                    </descriptors>
                                    <finalName>apache-maven-${version.maven}</finalName>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <!-- @formatter:on -->

    <properties>
    </properties>
</project>