<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">
    <parent>
        <groupId>org.opennms.alec</groupId>
        <artifactId>assembly</artifactId>
        <version>3.0.4</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.opennms.alec.assembly</groupId>
    <artifactId>org.opennms.alec.assembly.opennms.deb</artifactId>
    <name>ALEC :: Assembly :: OpenNMS Deb</name>
    <packaging>pom</packaging>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>net.sf.debian-maven</groupId>
                    <artifactId>debian-maven-plugin</artifactId>
                    <version>1.0.6</version>
                    <executions>
                        <execution>
                            <id>generate-deb</id>
                            <goals>
                                <goal>package</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <targetDir>${project.build.directory}</targetDir>
                        <packageName>opennms-alec-plugin</packageName>
                        <packageVersion>${project.version}</packageVersion>
                        <packageRevision>1</packageRevision>
                        <packageSection>contrib/net</packageSection>
                        <packageTitle>Architecture for Learning Enabled Correlation (ALEC)</packageTitle>
                        <packageDescription>ALEC</packageDescription>
                        <packageDependencies>
                            <packageDependency>opennms-plugin-api (&gt;= ${opennms.api.version})</packageDependency>
                            <packageDependency>opennms-plugin-api (&lt;&lt; ${opennms.api.version.max})</packageDependency>
                            <packageDependency>opennms-core</packageDependency>
                        </packageDependencies>
                        <maintainerName>Jesse White</maintainerName>
                        <maintainerEmail>jesse@opennms.com</maintainerEmail>
                        <excludeAllArtifacts>true</excludeAllArtifacts>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <attach>false</attach>
                    <appendAssemblyId>false</appendAssemblyId>
                    <outputDirectory>${project.build.directory}/releases/</outputDirectory>
                    <descriptors>
                        <descriptor>${basedir}/src/main/assemblies/plugin.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.coderplus.maven.plugins</groupId>
                <artifactId>copy-rename-maven-plugin</artifactId>
                <version>1.0.1</version>
                <executions>
                    <execution>
                        <id>copy-deb-resources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>rename</goal>
                        </goals>
                        <configuration>
                            <sourceFile>
                                ${project.build.directory}/releases/${project.artifactId}-${project.version}/alec/org.opennms.alec.assembly.kar-${project.version}.kar
                            </sourceFile>
                            <destinationFile>
                                ${project.build.directory}/deb/usr/share/opennms/deploy/opennms-alec-plugin.kar
                            </destinationFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>build.debs</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <file>
                    <exists>/usr/bin/dpkg-buildpackage</exists>
                </file>
                <property>
                    <name>build.packages</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>net.sf.debian-maven</groupId>
                        <artifactId>debian-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>org.opennms.alec.assembly</groupId>
            <artifactId>org.opennms.alec.assembly.kar</artifactId>
            <version>${project.version}</version>
            <type>kar</type>
        </dependency>
    </dependencies>
</project>
