<?xml version="1.0" encoding="UTF-8"?>
<!--
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - JOnAS: Java(TM) Open Application Server
  - Copyright (C) 2010 SERLI Informatique
  - Contact: jonas-team@ow2.org
  -
  - This library is free software; you can redistribute it and/or
  - modify it under the terms of the GNU Lesser General Public
  - License as published by the Free Software Foundation; either
  - version 2.1 of the License, or any later version.
  -
  - This library 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
  - Lesser General Public License for more details.
  -
  - You should have received a copy of the GNU Lesser General Public
  - License along with this library; if not, write to the Free Software
  - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
  - USA
  -
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - $Id: pom.xml 20961 2011-03-07 15:32:01Z benoitf $
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-->
<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">
  <parent>
    <groupId>org.ow2.jonas</groupId>
    <artifactId>autostart-lib</artifactId>
    <version>1.0.0-M2</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.ow2.jonas.autostart</groupId>
  <artifactId>utility</artifactId>
  <name>JOnAS :: Auto-Start :: Lib :: Utility</name>

  <properties>
    <jonas.services>db,resource,ejb3,jaxws,web,ear,depmonitor</jonas.services>
    <jonas.root>${project.build.directory}/jonas-full-${jonas.version}</jonas.root>
    <jonas.base>${project.build.directory}/jonas-base</jonas.base>
  </properties>


  <build>
    <plugins>

      <!-- Make sure tests always use randomly assigned and available ports -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-port-numbers</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>reserve-network-port</goal>
            </goals>
            <configuration>
              <portNames>
                <portName>webcontainer.port</portName>
                <portName>carol.port</portName>
                <portName>jms.port</portName>
                <portName>db.port</portName>
              </portNames>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- Unpack the JOnAS assembly -->
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-assembly</id>
            <phase>generate-test-resources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.ow2.jonas.assemblies.profiles</groupId>
                  <artifactId>jonas-full</artifactId>
                  <version>${jonas.version}</version>
                  <classifier>bin</classifier>
                  <type>zip</type>
                </artifactItem>
              </artifactItems>
              <outputDirectory> ${project.build.directory}</outputDirectory>
              <overWriteReleases>true</overWriteReleases>
              <overWriteSnapshots>true</overWriteSnapshots>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <systemProperties>
            <property>
              <name>jonas.base</name>
              <value>${jonas.base}</value>
            </property>
            <property>
              <name>jonas.root</name>
              <value>${jonas.root}</value>
            </property>
            <property>
              <name>jonas.version</name>
              <value>${jonas.version}</value>
            </property>
            <property>
              <name>work.directory</name>
              <value>${project.build.directory}/work</value>
            </property>
          </systemProperties>
        </configuration>
      </plugin>

      <!-- Configure JOnAS services and their port numbers -->
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>create-jonas-base-with-all-options</id>
            <phase>generate-test-resources</phase>
            <configuration>
              <tasks>
                <echo message="jonasRoot = ${jonas.root}" />
                <delete dir="${jonas.base}" />
                <mkdir dir="${jonas.base}/deploy" />

                <typedef resource="org/ow2/jonas/ant/antlib.xml" classpath="${jonas.root}/lib/common/ow_jonas_ant.jar" />

                <jonasbase jonasRoot="${jonas.root}" destDir="${jonas.base}" update="off">
                  <jonasProperties services="${jonas.services}" />
                  <webcontainer>
                    <tomcat>
                      <http port="${webcontainer.port}" />
                    </tomcat>
                    <jetty>
                      <http port="${webcontainer.port}" />
                    </jetty>
                  </webcontainer>
                  <jms port="${jms.port}" initialTopics="" initialQueues="" />
                  <carol defaultPort="${carol.port}" protocols="jrmp" />
                  <db port="${db.port}" />
                  <jdbcRa name="jdbc_1" mapperName="rdb.hsql" user="jonas" password="jonas" url="jdbc:hsqldb:hsql://localhost:${db.port}/db_jonas" driverName="org.hsqldb.jdbcDriver" jndiName="jdbc_1" autoload="on" />
                </jonasbase>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.ant</groupId>
      <artifactId>ant</artifactId>
      <version>1.8.0</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>proxy</artifactId>
      <version>${project.version}</version>
    </dependency>
  </dependencies>
</project>



