<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.appfuse.plugins</groupId>
        <artifactId>appfuse-plugins</artifactId>
        <version>2.2.1</version>
    </parent>

    <groupId>org.appfuse.plugins</groupId>
    <artifactId>appfuse-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <name>AppFuse Maven Plugin</name>

    <prerequisites>
        <maven>2.2.1</maven>
    </prerequisites>

    <scm>
        <connection>scm:git:git@github.com:appfuse/appfuse.git</connection>
        <developerConnection>scm:git:git@github.com:appfuse/appfuse.git</developerConnection>
        <url>http://source.appfuse.org/browse/appfuse/plugins/appfuse-maven-plugin</url>
      <tag>APPFUSE_2.2.1</tag>
  </scm>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-plugin-plugin</artifactId>
                <configuration>
                    <goalPrefix>appfuse</goalPrefix>
                </configuration>
                <version>2.6</version>
            </plugin>

        </plugins>
    </build>

    <distributionManagement>
        <site>
            <id>appfuse-plugins</id>
            <name>AppFuse Plugins Site</name>
            <url>scp://static.appfuse.org/var/www/appfuse-site/plugins/appfuse-maven-plugin</url>
        </site>
    </distributionManagement>

    <dependencies>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>2.0.8</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-interactivity-api</artifactId>
            <version>1.0-alpha-4</version>
            <exclusions>
                <exclusion>
                    <groupId>plexus</groupId>
                    <artifactId>plexus-utils</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-utils</artifactId>
            <version>1.5.6</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.mojo.hibernate3</groupId>
            <artifactId>maven-hibernate3-api</artifactId>
            <version>${hibernate3.plugin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.mojo.hibernate3</groupId>
            <artifactId>maven-hibernate3-jdk15</artifactId>
            <version>${hibernate3.plugin.version}</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.mojo.hibernate3</groupId>
            <artifactId>maven-hibernate3-jdk14</artifactId>
            <version>${hibernate3.plugin.version}</version>
        </dependency>
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>2.2</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
        </dependency>
        <!-- This is to support the ant calls within the mojos -->
        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <version>1.8.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant-nodeps</artifactId>
            <version>1.8.0</version>
        </dependency>
        <dependency>
            <groupId>hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <version>1.8.0.7</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons.io.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>${commons.beanutils.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.archetype</groupId>
            <artifactId>archetype-common</artifactId>
            <version>2.0-alpha-4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>2.0.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-embedder</artifactId>
            <version>2.0.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.shared</groupId>
            <artifactId>maven-plugin-testing-harness</artifactId>
            <version>1.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.tmatesoft</groupId>
            <artifactId>svnkit</artifactId>
            <version>1.1.2</version>
        </dependency>
        <!-- full text search -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-search</artifactId>
            <version>${hibernate.search.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <properties>
        <hibernate3.plugin.version>2.2</hibernate3.plugin.version>
        <invoker.debug>false</invoker.debug>
    </properties>

    <profiles>
        <profile>
            <id>itest</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-clean-plugin</artifactId>
                        <version>2.5</version>
                        <executions>
                            <execution>
                                <id>cleanup-archetype-project</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>clean</goal>
                                </goals>
                                <configuration>
                                    <excludeDefaultDirectories>true</excludeDefaultDirectories>
                                    <filesets>
                                        <fileset>
                                            <directory>${project.build.directory}/it/myproject</directory>
                                            <includes>
                                                <include>myproject/**</include>
                                                <include>pom.xml</include>
                                            </includes>
                                        </fileset>
                                    </filesets>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.2.1</version>
                        <executions>
                            <execution>
                                <id>generate-project</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>mvn</executable>
                                    <arguments>
                                        <argument>archetype:generate</argument>
                                        <argument>-B</argument>
                                        <argument>-DarchetypeGroupId=org.appfuse.archetypes</argument>
                                        <argument>-DarchetypeArtifactId=appfuse-basic-tapestry-archetype</argument>
                                        <argument>-DarchetypeVersion=${project.version}</argument>
                                        <argument>-DgroupId=com.mycompany</argument>
                                        <argument>-DartifactId=myproject</argument>
                                        <!-- probably not needed as the archetype has been installed previously by the build -->
                                        <argument>
                                            -DarchetypeRepository=http://oss.sonatype.org/content/repositories/appfuse
                                        </argument>
                                    </arguments>
                                    <workingDirectory>${project.build.directory}/it/myproject</workingDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <version>1.7</version>
                        <configuration>
                            <debug>${invoker.debug}</debug>
                            <projectsDirectory>src/it</projectsDirectory>
                            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                            <preBuildHookScript>setup</preBuildHookScript>
                            <postBuildHookScript>validate</postBuildHookScript>
                            <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                            <settingsFile>src/it/settings.xml</settingsFile>
                            <goals>
                                <goal>clean</goal>
                                <goal>process-sources</goal>
                            </goals>
                        </configuration>
                        <executions>
                            <execution>
                                <id>integration-test</id>
                                <goals>
                                    <goal>install</goal>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>

            </build>
        </profile>
    </profiles>
</project>
