<?xml version="1.0" encoding="utf-8"?>
<!--
 ~ Copyright (c) 2009-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 ~
 ~ Licensed under the Apache License, Version 2.0 (the "License");
 ~ you may not use this file except in compliance with the License.
 ~ You may obtain a copy of the License at
 ~
 ~      http://www.apache.org/licenses/LICENSE-2.0
 ~
 ~ Unless required by applicable law or agreed to in writing, software
 ~ distributed under the License is distributed on an "AS IS" BASIS,
 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 ~ See the License for the specific language governing permissions and
 ~ limitations under the License.
-->

<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.wso2.carbon.business-process</groupId>
        <artifactId>humantask</artifactId>
        <version>4.4.96</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>org.wso2.carbon.humantask</artifactId>
    <packaging>bundle</packaging>
    <name>WSO2 Carbon - Human Task Engine</name>
    <url>http://wso2.org</url>
    <description>WSO2 Human Task Engine</description>

    <dependencies>
        <dependency>
            <groupId>org.wso2.carbon.business-process</groupId>
            <artifactId>org.wso2.carbon.attachment.mgt</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.business-process</groupId>
            <artifactId>org.wso2.carbon.bpel.common</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2.wso2</groupId>
            <artifactId>axis2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.utils</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlbeans.wso2</groupId>
            <artifactId>xmlbeans</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.components.wso2</groupId>
            <artifactId>geronimo-connector</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.components.wso2</groupId>
            <artifactId>geronimo-transaction</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.ndatasource.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-jpa_2.0_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.commons.axiom.wso2</groupId>
            <artifactId>axiom</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.registry</groupId>
            <artifactId>org.wso2.carbon.registry.extensions</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-dbcp.wso2</groupId>
            <artifactId>commons-dbcp</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.openjpa</groupId>
            <artifactId>openjpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon</groupId>
            <artifactId>org.wso2.carbon.logging</artifactId>
        </dependency>
        <dependency>
            <groupId>net.sf.saxon.wso2</groupId>
            <artifactId>saxon.he</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database.wso2</groupId>
            <artifactId>h2-database-engine</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.business-process</groupId>
            <artifactId>org.wso2.carbon.humantask.skeleton</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.business-process</groupId>
            <artifactId>org.wso2.carbon.unifiedendpoint.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.commons</groupId>
            <artifactId>org.wso2.carbon.ntask.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.orbit.com.predic8</groupId>
            <artifactId>soa.model.core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <id>create-ht-database</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <path id="h2.classpath">
                                    <path refid="maven.compile.classpath" />
                                </path>

                                <echo message="########### Create HT Database ##############" />
                                <sql driver="org.h2.Driver" url="jdbc:h2:${basedir}/target/database/hth2db;create=true" userid="sa" password="" autocommit="true" onerror="continue">
                                    <classpath>
                                        <path refid="h2.classpath" />
                                    </classpath>
                                    <fileset file="${basedir}/target/h2.sql" />
                                </sql>
                                <echo message="##################### END ############################" />
                            </tasks>
                        </configuration>
                    </execution>
                    <execution>
                        <id>openjpa-enhancer</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <property name="maven.runtime.classpath" refid="maven.compile.classpath" />
                                <path id="classpath">
                                    <pathelement path="${maven.runtime.classpath}" />
                                </path>
                                <taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask" classpathref="classpath" />
                                <openjpac>
                                    <fileset dir="${basedir}/src/main">
                                        <include name="**/dao/jpa/openjpa/model/*.java" />
                                        <!--<include name="**/*.java" />-->
                                    </fileset>
                                    <classpath>
                                        <pathelement location="${basedir}/target/classes" />
                                        <pathelement path="${maven.runtime.classpath}" />
                                    </classpath>
                                </openjpac>
                            </tasks>
                        </configuration>
                    </execution>
                    <!--execution>
                        <id>xcreate-db-schemas</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <property name="maven.runtime.classpath" refid="maven.compile.classpath" />
                                <path id="classpath">
                                    <pathelement path="${maven.runtime.classpath}" />
                                </path>

                                <taskdef name="mappingtool" classname="org.apache.openjpa.jdbc.ant.MappingToolTask" classpathref="classpath" />

                                <mappingtool schemaAction="build" sqlFile="${basedir}/target/derby.sql" readSchema="false">
                                    <config DBDictionary="${vendor}" propertiesFile="src/main/resources/descriptors/persistence.derby.xml" />
                                    <classpath>
                                        <path refid="classpath" />
                                        <pathelement location="${basedir}/target/classes" />
                                    </classpath>
                                </mappingtool>
                                <mappingtool schemaAction="build" sqlFile="${basedir}/target/h2.sql" readSchema="false">
                                    <config DBDictionary="${vendor}" propertiesFile="src/main/resources/descriptors/persistence.h2.xml" />
                                    <classpath>
                                        <path refid="classpath" />
                                        <pathelement location="${basedir}/target/classes" />
                                    </classpath>
                                </mappingtool>

                                <mappingtool schemaAction="build" sqlFile="${basedir}/target/mysql.sql" readSchema="false">
                                    <config DBDictionary="${vendor}" propertiesFile="src/main/resources/descriptors/persistence.mysql.xml" />
                                    <classpath>
                                        <path refid="classpath" />
                                        <pathelement location="${basedir}/target/classes" />
                                    </classpath>
                                </mappingtool>
                                <mappingtool schemaAction="build" sqlFile="${basedir}/target/oracle.sql" readSchema="false">
                                    <config DBDictionary="${vendor}" propertiesFile="src/main/resources/descriptors/persistence.oracle.xml" />
                                    <classpath>
                                        <path refid="classpath" />
                                        <pathelement location="${basedir}/target/classes" />
                                    </classpath>
                                </mappingtool>
                                <mappingtool schemaAction="build" sqlFile="${basedir}/target/postgres.sql" readSchema="false">
                                    <config DBDictionary="${vendor}" propertiesFile="src/main/resources/descriptors/persistence.postgres.xml" />
                                    <classpath>
                                        <path refid="classpath" />
                                        <pathelement location="${basedir}/target/classes" />
                                    </classpath>
                                </mappingtool>
                                <mappingtool schemaAction="build" sqlFile="${basedir}/target/sqlserver.sql" readSchema="false">
                                    <config DBDictionary="${vendor}" propertiesFile="src/main/resources/descriptors/persistence.sqlserver.xml" />
                                    <classpath>
                                        <path refid="classpath" />
                                        <pathelement location="${basedir}/target/classes" />
                                    </classpath>
                                </mappingtool>
 				<mappingtool schemaAction="build" sqlFile="${basedir}/target/db2.sql" readSchema="false">
                                    <config DBDictionary="${vendor}" propertiesFile="src/main/resources/descriptors/persistence.db2.xml" />
                                    <classpath>
                                        <path refid="classpath" />
                                        <pathelement location="${basedir}/target/classes" />
                                    </classpath>
                                </mappingtool>
                            </tasks>
                        </configuration>
                    </execution-->
                    <!--Removed the stub-generation-->
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>xmlbeans-maven-plugin</artifactId>
                <version>2.3.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>xmlbeans</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <schemaDirectory>src/main/resources/schemas</schemaDirectory>
                    <xmlConfigs>
                        <xmlConfig implementation="java.io.File">
                            src/main/resources/schemas/xmlbeans.conf
                        </xmlConfig>
                    </xmlConfigs>
                    <noUpa>false</noUpa>
                    <sourceGenerationDirectory>
                        target/generated-code/src
                    </sourceGenerationDirectory>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>target/generated-code/src</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <!--excludes>
                        <exclude>**/ZipHumanTaskPackageHandler.java</exclude>
                    </excludes-->
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-scr-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>

                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                        <Bundle-Name>${project.artifactId}</Bundle-Name>
                        <Private-Package>
                            org.wso2.carbon.humantask.core.internal
                        </Private-Package>
                        <Export-Package>
                            !org.wso2.carbon.humantask.core.internal,
                            org.wso2.carbon.humantask.*
                        </Export-Package>
                        <Import-Package>
                            org.wso2.carbon.humantask.client.api.*;
                            version="${carbon.business-process.imp.pkg.version}",
                            org.wso2.carbon.humantask.skeleton.mgt.services.*;
                            version="${carbon.business-process.imp.pkg.version}",
                            org.wso2.carbon.humantask.skeleton.protocol.mgt.services.*;
                            version="${carbon.business-process.imp.pkg.version}",
                            org.wso2.carbon.bpel.common.*;
                            version="${carbon.business-process.imp.pkg.version}",
                            org.apache.axis2.*; version="${axis2.osgi.version.range}",
                            *;resolution:=optional
                        </Import-Package>
                        <DynamicImport-Package>*</DynamicImport-Package>
                        <JPA-PersistenceUnits>HT-PU</JPA-PersistenceUnits>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

