<?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>

    <name>Nessus :: H2 :: Server</name>

    <parent>
	    <groupId>io.nessus.h2</groupId>
	    <artifactId>nessus-h2</artifactId>
	    <version>1.2.1</version>
    </parent>
    
    <artifactId>nessus-h2-server</artifactId>
    <packaging>jar</packaging>
    
    <!-- Properties -->
    <properties>
        <docker.image.name>nessusio/nessus-h2</docker.image.name>
        <docker.image.from>nessusio/centosj</docker.image.from>
        <docker.image.version>latest</docker.image.version>
    </properties>

    <!-- Dependencies -->
    <dependencies>
        <dependency>
            <groupId>args4j</groupId>
            <artifactId>args4j</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
        <dependency>
            <groupId>io.nessus</groupId>
            <artifactId>nessus-common</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>io.nessus.h2.H2Server</mainClass>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Version>${project.version}</Implementation-Version>
                            <Implementation-Build>${buildNumber}</Implementation-Build>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
               <executions>
                    <execution>
                        <id>proj</id>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <phase>install</phase>
                        <configuration>
                            <descriptors>
                                <descriptor>scripts/assembly-proj.xml</descriptor>
                            </descriptors>
                            <finalName>${project.artifactId}</finalName>
                            <appendAssemblyId>false</appendAssemblyId>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <configuration>
                    <autoPull>always</autoPull>
                    <images>
                        <image>
                            <name>${docker.image.name}</name>
                            <build>
                                <dockerFile>${project.build.directory}/${project.artifactId}/context/Dockerfile</dockerFile>
                                <tags>
                                    <tag>${docker.image.version}</tag>
                                    <tag>${project.version}</tag>
                                </tags>
                            </build>
                        </image>
                    </images>
                </configuration>
                <executions>
                    <execution>
                        <id>remove-images</id>
                        <goals>
                            <goal>remove</goal>
                        </goals>
                        <phase>clean</phase>
                        <configuration>
                            <images>
                                <image>
                                    <name>${docker.image.name}:${docker.image.version}</name>
                                </image>
                                <image>
                                    <name>${docker.image.name}:${project.version}</name>
                                </image>
                            </images>
                        </configuration>
                    </execution>
                    <execution>
                        <id>build-docker-image</id>
                        <goals>
                            <goal>build</goal>
                        </goals>
                        <phase>install</phase>
                    </execution>
                    <execution>
                        <id>docker-push</id>
                        <goals>
                            <goal>push</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <skipPush>${skipPush}</skipPush>
                            <skipTag>true</skipTag>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
