<?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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.drools</groupId>
    <artifactId>drools-multiproject</artifactId>
    <version>5.4.0.Beta2</version>
  </parent>

  <artifactId>drools-examples</artifactId>

  <name>Drools examples</name>
  <description>Run DroolsExamplesApp to try the Drools rule engine examples.</description>

  <repositories>
    <!-- TODO remove this once maven central replicates the jboss repository -->
    <!-- Included so the examples sources in the distribution zip build out-of-the-box with maven -->
    <repository>
      <id>jboss-public-repository-group</id>
      <name>JBoss Public Repository Group</name>
      <url>http://repository.jboss.org/nexus/content/groups/public/</url>
      <layout>default</layout>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
      </releases>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
      </snapshots>
    </repository>
  </repositories>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <archive>
              <manifest>
                <!-- Needed for runExamples.sh and runExamples.bat -->
                <addClasspath>true</addClasspath>
                <classpathPrefix>../../binaries/</classpathPrefix>
              </manifest>
            </archive>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
        <configuration>
          <additionalBuildcommands>
            <buildcommand>org.drools.eclipse.droolsbuilder</buildcommand>
          </additionalBuildcommands>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <configuration>
          <executable>java</executable>
          <!-- only waltz12 is configured at the moment -->
          <!-- TODO waltz50, manners64 and manners128 -->
          <arguments>
            <argument>-Xms1024M</argument>
            <argument>-Xmx1024M</argument>
            <argument>-cp</argument>
            <classpath/>
            <argument>org.drools.benchmark.waltz.WaltzBenchmark</argument>
            <argument>waltz12.dat</argument>
          </arguments>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <!-- Internal dependencies -->
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>knowledge-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-compiler</artifactId>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-decisiontables</artifactId>
    </dependency>
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-templates</artifactId>
    </dependency>

    <!-- Needed for logging -->
    <dependency>
      <groupId>com.thoughtworks.xstream</groupId>
      <artifactId>xstream</artifactId>
    </dependency>

    <!-- Examples only dependencies. -->
    <!--
      WARNING: every examples only dependency must be properly dealt with in
      drools-distribution/src/main/assembly/assembly-drools.xml
    -->
    <dependency>
       <groupId>com.miglayout</groupId>
       <artifactId>miglayout</artifactId>
       <version>3.7.4</version>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>soaProfile</id>
      <activation>
        <property>
          <name>soa</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <inherited>false</inherited>
            <executions>
              <execution>
                <id>soa_overlay</id>
                <phase>process-resources</phase>
                <configuration>
                  <tasks>
                    <replace file="${basedir}/src/main/java/org/drools/examples/DroolsExamplesApp.java" >
                      <replacefilter token="Drools examples" value="JBoss BRMS examples" />
                    </replace>      
                    <replace file="${basedir}/src/main/java/org/drools/examples/sudoku/SudokuExample.java" >
                      <replacefilter token="Drools Sudoku Example" value="JBoss BRMS Sudoku Example" />
                    </replace>      

                    <replace file="${basedir}/src/main/java/org/drools/benchmark/DroolsBenchmarkExamplesApp.java" >
                      <replacefilter token="Drools Benchmark example" value="JBoss BRMS Benchmark example" />
                    </replace>      

                    <replace file="${basedir}/src/main/java/org/drools/tutorials/banking/BankingExamplesApp.java" >
                      <replacefilter token="Drools Banking tutorial" value="JBoss BRMS Banking tutorial" />
                    </replace>      
                  </tasks>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
