<?xml version="1.0" encoding="UTF-8"?>
<!--
  #%L
  VisualWAS
  %%
  Copyright (C) 2013 - 2019 Andreas Veithen
  %%
  This program 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.
  
  This program 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 this program.  If not, see
  <http://www.gnu.org/licenses/gpl-3.0.html>.
  #L%
  -->
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.github.veithen</groupId>
        <artifactId>parent</artifactId>
        <version>15</version>
    </parent>

    <groupId>com.github.veithen.visualwas</groupId>
    <artifactId>visualwas</artifactId>
    <version>3.0.0</version>
    <packaging>pom</packaging>

    <name>VisualWAS</name>
    <description>Open Source implementation of the WebSphere SOAP JMX protocol</description>
    <url>https://github.com/veithen/visualwas</url>
    <inceptionYear>2013</inceptionYear>
    <licenses>
        <license>
            <name>GNU General Public License (GPL) version 3.0</name>
            <distribution>http://www.gnu.org/licenses/gpl.html</distribution>
        </license>
    </licenses>

    <modules>
        <module>connector</module>
        <module>connector-tests</module>
        <module>systests</module>
        <module>dummy-transport</module>
        <module>loader</module>
        <module>clientlib</module>
        <module>visualvm-plugin</module>
        <module>samples</module>
        <module>websphere-api-stubs</module>
        <module>websphere-plugin</module>
        <module>thirdparty</module>
    </modules>

    <scm>
        <url>https://github.com/veithen/visualwas/tree/master</url>
        <connection>scm:git:http://github.com/veithen/visualwas.git</connection>
        <developerConnection>scm:git:https://github.com/veithen/visualwas.git</developerConnection>
        <tag>3.0.0</tag>
    </scm>

    <properties>
        <javaVersion>1.8</javaVersion>
        <github.repository>visualwas</github.repository>
        <axiom.version>1.2.21</axiom.version>
    </properties>

    <repositories>
        <repository>
            <id>sonatype-snapshots</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
        <repository>
            <!-- For Axiom -->
            <id>apache.snapshots</id>
            <name>Apache Snapshot Repository</name>
            <url>https://repository.apache.org/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.ws.commons.axiom</groupId>
                <artifactId>axiom-api</artifactId>
                <version>${axiom.version}</version>
                <exclusions>
                    <exclusion>
                        <!-- Already included in Java 6 -->
                        <groupId>org.apache.geronimo.specs</groupId>
                        <artifactId>geronimo-stax-api_1.0_spec</artifactId>
                    </exclusion>
                    <exclusion>
                        <!-- We don't use XPath -->
                        <groupId>jaxen</groupId>
                        <artifactId>jaxen</artifactId>
                    </exclusion>
                    <exclusion>
                        <!-- We don't use MTOM or SwA -->
                        <groupId>org.apache.james</groupId>
                        <artifactId>apache-mime4j-core</artifactId>
                    </exclusion>
                    <exclusion>
                        <!-- Geronimo's Activation implementation doesn't work well -->
                        <groupId>org.apache.geronimo.specs</groupId>
                        <artifactId>geronimo-activation_1.1_spec</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.sun.activation</groupId>
                <artifactId>javax.activation</artifactId>
                <version>1.2.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.ws.commons.axiom</groupId>
                <artifactId>axiom-impl</artifactId>
                <version>${axiom.version}</version>
                <exclusions>
                    <exclusion>
                        <!-- We use the StAX implementation from the JRE -->
                        <groupId>org.codehaus.woodstox</groupId>
                        <artifactId>woodstox-core-asl</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.ws.commons.axiom</groupId>
                <artifactId>axiom-dom</artifactId>
                <version>${axiom.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.codehaus.woodstox</groupId>
                        <artifactId>woodstox-core-asl</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.eclipse.osgi</groupId>
                <artifactId>org.eclipse.osgi</artifactId>
                <version>3.7.1</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>1.12</version>
                </plugin>
                <plugin>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>2.10</version>
                </plugin>
                <plugin>
                    <groupId>io.fabric8</groupId>
                    <artifactId>docker-maven-plugin</artifactId>
                    <version>0.24.0</version>
                    <configuration>
                        <skip>${skipTests}</skip>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <!-- Turn off annotation processing. No class files get generated during
                    compilation when one of the annotation processors in the Netbeans library is
                    active. -->
                    <proc>none</proc>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.4.0</version>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <configuration>
                    <projectName>VisualWAS</projectName>
                    <licenseName>gpl_v3</licenseName>
                    <excludes>
                        <exclude>**/*-request.xml</exclude>
                        <exclude>**/*-response.xml</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>de.jutzig</groupId>
                <artifactId>github-release-plugin</artifactId>
                <configuration>
                    <description>VisualWAS version ${project.version}</description>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>docker</id>
            <activation>
                <property>
                    <name>env.WEBSPHERE_VERSION</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <inherited>false</inherited>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/jacoco</outputDirectory>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.jacoco</groupId>
                                            <artifactId>org.jacoco.agent</artifactId>
                                            <classifier>runtime</classifier>
                                            <destFileName>agent.jar</destFileName>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <inherited>false</inherited>
                        <executions>
                            <execution>
                                <phase>package</phase>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                                <configuration>
                                    <images>
                                        <image>
                                            <name>visualwas-websphere-base:${env.WEBSPHERE_VERSION}</name>
                                            <build>
                                                <from>ibmcom/websphere-traditional:${env.WEBSPHERE_VERSION}-profile</from>
                                                <!-- Replace the start_server script with a wrapper script that executes the generated
                                                     server startup script. -->
                                                <assembly>
                                                    <basedir>/work</basedir>
                                                    <inline>
                                                        <fileSets>
                                                            <fileSet>
                                                                <directory>src/main/scripts</directory>
                                                                <outputDirectory>/</outputDirectory>
                                                            </fileSet>
                                                            <fileSet>
                                                                <directory>${project.build.directory}/jacoco</directory>
                                                                <outputDirectory>jacoco</outputDirectory>
                                                            </fileSet>
                                                        </fileSets>
                                                    </inline>
                                                </assembly>
                                                <runCmds>
                                                    <runCmd>/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/wsadmin.sh -conntype NONE -lang jython -f /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/deployConsole.py remove</runCmd>
                                                    <runCmd>/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/wsadmin.sh -conntype NONE -lang jython -f /work/configureSecurity.py</runCmd>
                                                    <runCmd>/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/wsadmin.sh -conntype NONE -lang jython -f /work/configureAgent.py</runCmd>

                                                    <!-- Generate a start script so that we can further accelerate the startup of container
                                                         based on this image. -->
                                                    <runCmd>/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/bin/startServer.sh server1 -script /work/start_server1.sh</runCmd>
                                                </runCmds>
                                            </build>
                                        </image>
                                    </images>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
