<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.basho.riak.protobuf</groupId>
    <artifactId>riak-pb</artifactId>
    <version>2.0.0.16</version>
    <packaging>jar</packaging>

    <name>Riak Protocol Buffers</name>
    <description>Protocol buffers used to communicate with Riak</description>
    <url>https://github.com/basho/riak_pb</url>
    
    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Brian Roach</name>
            <email>roach@basho.com</email>
        </developer>
    </developers>
    
    <scm>
        <connection>scm:git:ssh://git@github.com/basho/riak_pb.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/basho/riak_pb.git</developerConnection>
        <url>http://github.com/basho/riak_pb</url>
    </scm>
    
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.8</version>
                <configuration>
                    <excludePackageNames>com.basho.riak.protobuf.util</excludePackageNames>
                </configuration>
                <executions>
                    <execution>
                    <id>attach-javadocs</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.webguys</groupId>
                <artifactId>string-template-maven-plugin</artifactId>
                <version>1.1</version>
                <configuration>
                    <templates>
                        <template>
                            <directory>${basedir}/src/main/resources</directory>
                            <name>RiakMessageCodes</name>
                            <target>${basedir}/target/generated-sources/protobuf/com/basho/riak/protobuf/RiakMessageCodes.java</target>
                            <controller>
                                <className>com.basho.riak.protobuf.util.TemplateController</className>
                                <method>getProperties</method>
                            </controller>
                        </template>
                    </templates>
                </configuration>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>render</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.twdata.maven</groupId>
                        <artifactId>mojo-executor</artifactId>
                        <version>2.2.0</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.igor-petruk.protobuf</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>
                <version>0.5.2</version>
                <configuration>
                    <inputDirectories>
                        <directory>${project.basedir}/src</directory>
                    </inputDirectories>
                </configuration> 
                <executions>
                    <execution>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <excludes>
                        <exclude>**/util/*</exclude>
                        <exclude>**/util</exclude>
                        <exclude>**/*.st</exclude>
                        <exclude>**/*.csv</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.1.2</version>
                <configuration>
                    <excludes>
                        <exclude>**/util/*</exclude>
                        <exclude>**/util</exclude>
                        <exclude>**/*.st</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <version>1.1.1</version>
                        <executions>
                            <execution>
                                <id>enforce-environment</id>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>enforce</goal>
                                </goals>
                                <configuration>
                                    <rules>
                                    <requireProperty>
                                        <property>skip.deploy</property>
                                        <regex>true</regex>
                                        <message>*** You must set the RELEASE_GPG_KEYNAME environment variable to deploy! ***</message>
                                    </requireProperty>
                                    </rules>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>2.7</version>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin> 
                </plugins>
            </build>
        </profile>
        <profile>
            <id>deploy</id>
            <activation>
                <property>
                    <name>env.RELEASE_GPG_KEYNAME</name>
                </property>
            </activation>
            <distributionManagement>
                <snapshotRepository>
                    <id>sonatype-nexus-snapshots</id>
                    <name>Sonatype Nexus Snapshots</name>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>sonatype-nexus-staging</id>
                    <name>Nexus Release Repository</name>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
                </repository>
            </distributionManagement>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.4</version>
                        <configuration>
                            <useAgent>true</useAgent>
                            <keyname>${env.RELEASE_GPG_KEYNAME}</keyname>
                        </configuration>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-deploy-plugin</artifactId>
                        <version>2.7</version>
                        <configuration>
                            <skip>false</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <dependencies>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>2.5.0</version>
        </dependency>
        <dependency>
            <groupId>org.antlr</groupId>
            <artifactId>antlr-complete</artifactId>
            <version>3.5.1</version>
        </dependency>
    </dependencies>
</project>
