<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Hibernate, Relational Persistence for Idiomatic Java
  ~
  ~ Copyright (c) 2011, Red Hat Inc. or third-party contributors as
  ~ indicated by the @author tags or express copyright attribution
  ~ statements applied by the authors.  All third-party contributions are
  ~ distributed under license by Red Hat Inc.
  ~
  ~ This copyrighted material is made available to anyone wishing to use, modify,
  ~ copy, or redistribute it subject to the terms and conditions of the GNU
  ~ Lesser General Public License, as published by the Free Software Foundation.
  ~
  ~ 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 Lesser General Public License
  ~ for more details.
  ~
  ~ You should have received a copy of the GNU Lesser General Public License
  ~ along with this distribution; if not, write to:
  ~ Free Software Foundation, Inc.
  ~ 51 Franklin Street, Fifth Floor
  ~ Boston, MA  02110-1301  USA
  -->
<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>

    <parent>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-parent</artifactId>
        <version>3.6.10.Final</version>
        <relativePath>../hibernate-parent/pom.xml</relativePath>
    </parent>

    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-distribution</artifactId>
    <packaging>pom</packaging>

    <name>Hibernate Distribution</name>
    <description>Builds the complete Hibernate distribution bundles</description>

    <properties>
        <!-- Skip artifact deployment -->
        <maven.deploy.skip>true</maven.deploy.skip>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.groovy.maven</groupId>
                <artifactId>gmaven-plugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <source><![CDATA[
                                def sourcePathName = 'javadocSourcePath'
                                sourcePath = ant.path( id:sourcePathName ) {
                                    ant.pathElement( path: "${project.basedir}/../hibernate-ehcache/src/main/java" )
                                    ant.pathElement( path: "${project.basedir}/../hibernate-infinispan/src/main/java" )
                                    ant.pathElement( path: "${project.basedir}/../hibernate-/src/main/java" )
                                    ant.pathElement( path: "${project.basedir}/../hibernate-oscache/src/main/java" )
                                    ant.pathElement( path: "${project.basedir}/../hibernate-swarmcache/src/main/java" )
                                    ant.pathElement( path: "${project.basedir}/../hibernate-c3p0/src/main/java" )
                                    ant.pathElement( path: "${project.basedir}/../hibernate-proxool/src/main/java" )
                                    ant.pathElement( path: "${project.basedir}/../hibernate-entitymanager/src/main/java" )
                                    ant.pathElement( path: "${project.basedir}/../hibernate-envers/src/main/java" )
                                    ant.pathElement( path: "${project.basedir}/../hibernate-testing/src/main/java" )
                                    ant.pathElement( path: "${project.basedir}/../hibernate-core/src/main/java" )
                                    ant.pathElement( path: "${project.basedir}/../hibernate-core/target/generated-sources/antlr" )
                                }

                                def classPathName = 'javadocClassPath'
                                classPath = ant.path( id:classPathName );
                                project.compileClasspathElements.each{ element ->
                                    classPath.createPathElement().path = element
                                }

                                targetDir = "${project.basedir}/target/javadocs";

                                ant.javadoc(
                                    executable: '${jdk16_home}/bin/javadoc',
                                    maxmemory: '512m',
                                    destdir: targetDir ,
                                    sourcepathref: sourcePathName,
                                    classpathref: classPathName,
                                    overview: '${project.basedir}/src/javadoc/package.html',
                                    stylesheetfile: '${project.basedir}/src/javadoc/stylesheet.css',
                                    windowtitle: 'Hibernate JavaDocs',
                                    doctitle: 'Hibernate JavaDoc (${project.version})',
                                    bottom: 'Copyright &copy; 2001-2010 <a href="http://redhat.com">Red Hat, Inc.</a>  All Rights Reserved.',
                                    use: true
                                ) {
                                    ant.link( href: 'http://java.sun.com/j2se/1.5.0/docs/api' )
                                    ant.link( href: 'http://java.sun.com/javaee/5/docs/api/' )
                                    ant.tag( name: 'todo', description: 'To do:' )
                                    ant.tag( name: 'noinspection', enabled: false )
                                    ant.group( title: 'Core API' ) {
                                        ant.package( name: 'org.hibernate' )
                                        ant.package( name: 'org.hibernate.classic' )
                                        ant.package( name: 'org.hibernate.criterion' )
                                        ant.package( name: 'org.hibernate.mapping' )
                                        ant.package( name: 'org.hibernate.metadata' )
                                        ant.package( name: 'org.hibernate.cfg' )
                                        ant.package( name: 'org.hibernate.stat' )
                                    }
                                    ant.group( title: 'Extension SPI' ) {
                                        ant.package( name: 'org.hibernate.id*' )
                                        ant.package( name: 'org.hibernate.connection' )
                                        ant.package( name: 'org.hibernate.transaction' )
                                        ant.package( name: 'org.hibernate.type' )
                                        ant.package( name: 'org.hibernate.dialect*' )
                                        ant.package( name: 'org.hibernate.cache*' )
                                        ant.package( name: 'org.hibernate.event*' )
                                        ant.package( name: 'org.hibernate.property' )
                                        ant.package( name: 'org.hibernate.loader*' )
                                        ant.package( name: 'org.hibernate.persister*' )
                                        ant.package( name: ':org.hibernate.proxy' )
                                        ant.package( name: 'org.hibernate.tuple' )
                                        ant.package( name: 'org.hibernate.transform' )
                                        ant.package( name: 'org.hibernate.collection' )
                                        ant.package( name: 'org.hibernate.jdbc' )
                                        ant.package( name: 'org.hibernate.usertype' )
                                    }
                                    ant.group( title: 'Bytecode providers' ) {
                                        ant.package( name: 'org.hibernate.bytecode*' )
                                        ant.package( name: 'org.hibernate.intercept*' )
                                    }
                                    ant.group( title: 'Infinispan Integration' ) {
                                        ant.package( name: 'org.hibernate.cache.infinispan*' )
                                    }
                                    ant.group( title: 'JBossCache Integration' ) {
                                        ant.package( name: 'org.hibernate.cache.jbc*' )
                                    }
                                    ant.group( title: 'Testing Support' ) {
                                        ant.package( name: 'org.hibernate.junit*' )
                                    }
                                }

                                imagesDir = targetDir + '/images'
                                ant.mkdir( dir: imagesDir )
                                ant.copy( toDir: imagesDir ) {
                                    fileset( dir: "${project.basedir}/src/javadoc/images" )
                                }
                                ]]>
                            </source>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>deploy</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.2-beta-2</version>
                    <configuration>
                        <descriptors>
                            <descriptor>src/assembly/hibernate-all.xml</descriptor>
                            <descriptor>src/assembly/dist.xml</descriptor>
                        </descriptors>
                        <archive>
                            <manifest>
                                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            </manifest>
                            <manifestEntries>
                                <Implementation-URL>http://hibernate.org</Implementation-URL>
                            </manifestEntries>
                        </archive>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <!--
        The assemblies work off of dependency sets since the stuff to be
        aggregated is no longer sub-modules after moving assembly itself
        into this 'distribution' module.
    -->
    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>hibernate-ehcache</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>hibernate-jbosscache</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>hibernate-infinispan</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>hibernate-oscache</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>hibernate-swarmcache</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>hibernate-c3p0</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>hibernate-proxool</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>hibernate-envers</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- optional deps for bytecode providers since they are optional on core -->
        <dependency>
            <groupId>javassist</groupId>
            <artifactId>javassist</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <optional>true</optional>
        </dependency>

        <!-- Because Maven is retarded -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.javaee</groupId>
            <artifactId>jboss-jacc-api_JDK4</artifactId>
            <version>1.1.0</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.jboss.javaee</groupId>
                    <artifactId>jboss-servlet-api_3.0</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.jboss.logging</groupId>
                    <artifactId>jboss-logging-spi</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.jboss</groupId>
                    <artifactId>jboss-common-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>ant</groupId>
            <artifactId>ant</artifactId>
            <version>1.6.5</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <!--
                A profile used implicitly by the release plugin.  Here we use
                it to implicitly execute assembly building when deploy is executed
                as part of release ( I think/hope :p )
            -->
            <id>release-profile</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.2-beta-2</version>
                        <executions>
                            <execution>
                                <phase>deploy</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
