<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>com.github.mike10004</groupId>
        <artifactId>mysql-dists</artifactId>
        <version>1.0.2</version>
    </parent>
    <artifactId>mysql-dist</artifactId>
    <version>5.7.14</version>
    <packaging>pom</packaging>
    <name>mysql-5.7.14-mac-x86_64</name> <!-- e.g. mariadb-freebsd10 -->
    <description>Portable MySQL Maven artifact for Mac OS X 10.11</description>
    <url>https://github.com/mike10004/mysql-dists</url>
    <properties>
        <distro.basename>mysql-5.7.14-osx10.11-x86_64</distro.basename> <!-- e.g. mariadb-10.0.27-linux-x86_64 -->
        <distro.url>https://cdn.mysql.com/Downloads/MySQL-5.7/${distro.basename}.tar.gz</distro.url>
        <distro.sha1>3224dba017fb283af263381849ecd337ce9e93b8</distro.sha1>
        <assembly.id>mac-x86_64</assembly.id> <!-- e.g. freebsd-amd64 -->
    </properties>
    <profiles>
        <profile>
            <id>practice</id>
            <properties>
                <distro.basename>ziptest-1.0</distro.basename>
                <distro.url>http://localhost/~${user.name}/mysql-dists-test/${distro.basename}.tar.gz</distro.url>
                <distro.sha1>ae45bbd93e847b5304ed6ce901c1df2e8c8fcac1</distro.sha1>
                <assembly.id>practice-distro</assembly.id>
            </properties>
        </profile>
    </profiles>
    <build>
        <plugins>
            <plugin>
                <groupId>com.googlecode.maven-download-plugin</groupId>
                <artifactId>download-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>download-mysql-distribution-tarball</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <configuration>
                            <url>${distro.url}</url>
                            <sha1>${distro.sha1}</sha1>
                        </configuration>
                    </execution>
                </executions>
            </plugin>            
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>untar-mysql-distribution</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>tar</executable>
                            <arguments>
                                <argument>xf</argument>
                                <argument>${project.build.directory}/${distro.basename}.tar.gz</argument>
                                <argument>-C</argument>
                                <argument>${project.build.directory}</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>    
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>distro-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>src/assembly/release.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-gpg-plugin</artifactId>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>            
            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
