<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2014 Lukas Krejci
  ~
  ~ 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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <name>Revapi parent</name>
    <description>
        Parent POM for revapi projects. Common deps and site.
    </description>
    <url>http://revapi.org</url>
    
    <groupId>org.revapi</groupId>
    <artifactId>revapi-parent</artifactId>
    <packaging>pom</packaging>
    <version>0.1.0</version>

    <properties>
        <findbugs.skip>true</findbugs.skip>
        <fastBuild>false</fastBuild>
        <skip.awestruct.site>false</skip.awestruct.site>
        <skip.site>false</skip.site>
        <skip.deploy>false</skip.deploy>
        <web.url>http://revapi.org</web.url>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.revapi</groupId>
                <artifactId>revapi</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>org.revapi</groupId>
                <artifactId>revapi-reporting-text</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>org.revapi</groupId>
                <artifactId>revapi-java</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>org.revapi</groupId>
                <artifactId>revapi-java-spi</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>org.revapi</groupId>
                <artifactId>revapi-basic-features</artifactId>
                <version>${project.version}</version>
            </dependency>

            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.11</version>
            </dependency>

            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.7.5</version>
            </dependency>

            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>0.9.29</version>
            </dependency>

            <dependency>
                <groupId>com.google.code.findbugs</groupId>
                <artifactId>jsr305</artifactId>
                <version>2.0.3</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.google.code.findbugs</groupId>
            <artifactId>jsr305</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <modules>
        <module>revapi</module>
        <module>revapi-java</module>
        <module>revapi-java-spi</module>
        <module>revapi-basic-features</module>
        <module>revapi-reporting-text</module>
        <module>revapi-maven-plugin</module>
        <module>revapi-standalone</module>
    </modules>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>findbugs-maven-plugin</artifactId>
                    <version>2.5.3</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>2.4</version>
                </plugin>
                <plugin>
                    <artifactId>maven-failsafe-plugin</artifactId>
                    <version>2.16</version>
                </plugin>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.16</version>
                </plugin>
                <plugin>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.3</version>
                </plugin>
                <plugin>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>2.7</version>
                </plugin>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.6</version>
                </plugin>
                <plugin>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.2.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>2.9</version>
                </plugin>
                <plugin>
                    <artifactId>maven-project-info-reports-plugin</artifactId>
                    <version>2.7</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                        <configuration>
                            <skip>${findbugs.skip}</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <configuration>
                    <skipSource>${fastBuild}</skipSource>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <skip>${fastBuild}</skip>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <reportSets>
                    <reportSet>
                        <reports/>
                    </reportSet>
                </reportSets>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>javadoc</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Lukas Krejci</name>
            <email>krejci.l@centrum.cz</email>
            <url>http://metlos.wordpress.com</url>
            <timezone>+1</timezone>
        </developer>
    </developers>

    <issueManagement>
        <system>github-issues</system>
        <url>https://github.com/revapi/revapi/issues</url>
    </issueManagement>

    <ciManagement>
        <system>travis</system>
        <url>https://travis-ci.org/revapi/revapi</url>
    </ciManagement>

    <mailingLists>
        <mailingList>
            <name>Revapi</name>
            <subscribe>https://groups.google.com/groups/revapi</subscribe>
            <unsubscribe>https://groups.google.com/groups/revapi</unsubscribe>
            <post>mailto:revapi@googlegroups.com</post>
            <archive>https://groups.google.com/groups/revapi</archive>
        </mailingList>
    </mailingLists>

    <scm>
        <connection>scm:git:git://github.com/revapi/revapi.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/revapi/revapi.git</developerConnection>
        <url>https://github.com/revapi/revapi</url>
    </scm>

    <distributionManagement>
        <site>
            <id>site</id>
            <url>${web.url}</url>
        </site>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://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>
    
    <profiles>
        <profile>
            <id>site</id>

            <modules/>

            <build>
                <resources>
                    <resource>
                        <filtering>true</filtering>
                        <directory>${project.basedir}/src/site/</directory>
                    </resource>
                    <resource>
                        <directory>${project.basedir}/src/main/resources</directory>
                    </resource>
                </resources>

                <plugins>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>site</id>
                                <goals>
                                    <goal>resources</goal>
                                </goals>
                                <phase>pre-site</phase>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/_site</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.7</version>
                        <executions>
                            <execution>
                                <id>site</id>
                                <phase>site</phase>
                                <configuration>
                                    <skip>${skip.awestruct.site}</skip>
                                    <tasks>
                                        <!-- The root model generates a maven-site, but we'll be replacing it completely.
                                             The submodules' site outputs are redirected under "generated" in the resulting
                                             site -->
                                        <delete dir="${project.build.directory}/site/"
                                                excludes="generated/* css/* js/*"/>
                                        <exec command="rake update" dir="${project.build.directory}/_site"/>
                                        <exec command="awestruct -P production -g -w"
                                              dir="${project.build.directory}/_site"/>
                                        <copy todir="${project.build.directory}/site">
                                            <fileset dir="${project.build.directory}/_site" includes=".nojekyll"/>
                                            <fileset dir="${project.build.directory}/_site" includes="CNAME"/>
                                            <fileset dir="${project.build.directory}/_site/_site" excludes="apt/**"/>
                                        </copy>
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>site-cleanup</id>
                                <phase>post-site</phase>
                                <configuration>
                                    <tasks>
                                        <delete dir="${project.build.directory}/_site"/>
                                    </tasks>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-site-plugin</artifactId>
                        <version>3.3</version>
                        <configuration>
                            <skip>${skip.site}</skip>
                            <skipDeploy>true</skipDeploy>
                        </configuration>
                        <executions>
                            <execution>
                                <configuration>
                                    <skip>${skip.deploy}</skip>
                                    <skipDeploy>true</skipDeploy>
                                </configuration>
                                <phase>post-site</phase>
                                <goals>
                                    <goal>stage</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.github.github</groupId>
                        <artifactId>site-maven-plugin</artifactId>
                        <version>0.10</version>
                        <configuration>
                            <message>Committing site for version ${project.version}.</message>
                            <server>github</server>
                            <skip>${skip.deploy}</skip>
                            <outputDirectory>${project.build.directory}/staging</outputDirectory>
                            <branch>refs/heads/master</branch>
                            <repositoryName>revapi.github.io</repositoryName>
                            <repositoryOwner>revapi</repositoryOwner>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>site</goal>
                                </goals>
                                <phase>site-deploy</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.4</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.10.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-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
