<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2012-2015 TORCH GmbH, 2015-2016 Graylog, Inc.
  ~
  ~ This file is part of Graylog.
  ~
  ~ Graylog is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU General Public License as published by
  ~ the Free Software Foundation, either version 3 of the License, or
  ~ (at your option) any later version.
  ~
  ~ Graylog is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~ GNU General Public License for more details.
  ~
  ~ You should have received a copy of the GNU General Public License
  ~ along with Graylog.  If not, see <http://www.gnu.org/licenses />.
  -->
<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>
    <prerequisites>
        <maven>3.1.0</maven>
    </prerequisites>

    <modules>
        <module>graylog-plugin-web-parent</module>
    </modules>

    <parent>
        <groupId>org.graylog</groupId>
        <artifactId>graylog-parent</artifactId>
        <version>2.2.0</version>
    </parent>

    <groupId>org.graylog.plugins</groupId>
    <artifactId>graylog-plugin-parent</artifactId>
    <packaging>pom</packaging>

    <name>Graylog Plugin Parent POM</name>

    <properties>
        <graylog.plugin-dir>/usr/share/graylog-server/plugin</graylog.plugin-dir>

        <!-- Dependencies -->
        <auto-service.version>1.0-rc2</auto-service.version>

        <!-- Plugin versions -->
        <jdeb.version>1.5</jdeb.version>
        <rpm-maven.version>2.1.5</rpm-maven.version>
        <license-maven.version>2.11</license-maven.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.graylog2</groupId>
                <artifactId>graylog2-server</artifactId>
                <!--
                This might break at some point, if the version of the Parent POM
                isn't identical to the version of Graylog.
                -->
                <version>${project.parent.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.graylog2</groupId>
            <artifactId>graylog2-server</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.mycila</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>${license-maven.version}</version>
                </plugin>

                <plugin>
                    <artifactId>jdeb</artifactId>
                    <groupId>org.vafer</groupId>
                    <version>${jdeb.version}</version>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>rpm-maven-plugin</artifactId>
                    <version>${rpm-maven.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${basedir}</directory>
                            <includes>
                                <include>build/**/*</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>jdeb</artifactId>
                <groupId>org.vafer</groupId>
                <configuration>
                    <deb>${project.build.directory}/${project.artifactId}-${project.version}.deb</deb>
                    <dataSet>
                        <data>
                            <src>${project.build.directory}/${project.build.finalName}.jar</src>
                            <type>file</type>
                            <mapper>
                                <type>perm</type>
                                <prefix>${graylog.plugin-dir}</prefix>
                                <filemode>644</filemode>
                                <user>root</user>
                                <group>root</group>
                            </mapper>
                        </data>
                    </dataSet>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>rpm-maven-plugin</artifactId>
                <configuration>
                    <group>Application/Internet</group>
                    <prefixes>
                        <prefix>/usr</prefix>
                    </prefixes>
                    <defineStatements>
                        <defineStatement>_unpackaged_files_terminate_build 0</defineStatement>
                        <defineStatement>_binaries_in_noarch_packages_terminate_build 0</defineStatement>
                    </defineStatements>
                    <defaultFilemode>644</defaultFilemode>
                    <defaultDirmode>755</defaultDirmode>
                    <defaultUsername>root</defaultUsername>
                    <defaultGroupname>root</defaultGroupname>
                    <mappings>
                        <mapping>
                            <directory>${graylog.plugin-dir}</directory>
                            <sources>
                                <source>
                                    <location>${project.build.directory}/</location>
                                    <includes>
                                        <include>${project.build.finalName}.jar</include>
                                    </includes>
                                </source>
                            </sources>
                        </mapping>
                    </mappings>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
