<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>

  <groupId>org.reflext</groupId>
  <artifactId>reflext.parent</artifactId>
  <version>1.0.0-beta3</version>
  <packaging>pom</packaging>

  <name>Reflext Framework</name>
  <description>The Reflext project provides an abstraction over various Java reflection model and provides advanced operations that are not covered by the existing models</description>
  <url>http://reflext.googlecode.com/</url>

  <organization>
    <name>eXo Platform SAS</name>
    <url>http://www.exoplatform.com</url>
  </organization>
  <licenses>
    <license>
      <name>LGPL, version 2.1</name>
      <url>http://www.opensource.org/licenses/lgpl-license.php</url>
    </license>
  </licenses>

  <scm>
    <connection>scm:svn:http://reflext.googlecode.com/svn/tags/1.0.0-beta3</connection>
    <developerConnection>scm:svn:https://reflext.googlecode.com/svn/tags/1.0.0-beta3</developerConnection>
    <url>http://code.google.com/p/reflext/source/browse/tags/1.0.0-beta3</url>
  </scm>

  <distributionManagement>
    <repository>
      <!-- Copy the distribution jar file to a local and dedicated remote repository 
        -  This variable has to be set in ~/.m2/settings.xml -->
      <id>repository.reflext.org</id>
      <url>${reflext.distrib.repo.url}</url>
    </repository>
  </distributionManagement>

  <properties>
    <!-- Plugins settings -->

    <!-- Cross plugins settings -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <!-- maven-compiler-plugin -->
    <maven.compiler.target>1.5</maven.compiler.target>
    <maven.compiler.source>1.5</maven.compiler.source>

    <!-- maven-release-plugin -->
    <useReleaseProfile>false</useReleaseProfile>
    <arguments>-Prelease</arguments>
    <autoVersionSubmodules>true</autoVersionSubmodules>
  </properties>

  <dependencyManagement>
    <!-- Versions of dependencies have to be the same in all modules -->
    <!-- With that we never define versions in sub-modules -->
    <dependencies>
      <!-- Internal deps -->
      <dependency>
        <groupId>org.reflext</groupId>
        <artifactId>reflext.api</artifactId>
        <version>1.0.0-beta3</version>
      </dependency>
      <dependency>
        <groupId>org.reflext</groupId>
        <artifactId>reflext.apt</artifactId>
        <version>1.0.0-beta3</version>
      </dependency>
      <dependency>
        <groupId>org.reflext</groupId>
        <artifactId>reflext.core</artifactId>
        <version>1.0.0-beta3</version>
      </dependency>
      <dependency>
        <groupId>org.reflext</groupId>
        <artifactId>reflext.jlr</artifactId>
        <version>1.0.0-beta3</version>
      </dependency>
      <dependency>
        <groupId>org.reflext</groupId>
        <artifactId>reflext.spi</artifactId>
        <version>1.0.0-beta3</version>
      </dependency>
      <dependency>
        <groupId>org.reflext</groupId>
        <artifactId>reflext.test-java5</artifactId>
        <version>1.0.0-beta3</version>
      </dependency>
      <dependency>
        <groupId>org.reflext</groupId>
        <artifactId>reflext.test-java6</artifactId>
        <version>1.0.0-beta3</version>
      </dependency>
      <!-- External deps -->
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8</version>
      </dependency>
      <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.5.8</version>
      </dependency>

    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <!-- All plugins versions have to be set -->
      <!-- Plugins are sorted by shortname : clean, deploy, ... -->
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>2.3</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.0.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <version>1.0-beta-1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.3</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>2.2</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>2.6</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.0-beta-9</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>2.4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>2.0.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.1</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.4.3</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>

    <profile>
      <!-- Only some modules are built with Java 1.5 -->
      <id>Java5</id>
      <activation>
        <jdk>1.5</jdk>
      </activation>
      <modules>
        <module>api</module>
        <module>spi</module>
        <module>jlr</module>
        <module>core</module>
        <module>test-java5</module>
        <module>test</module>
      </modules>
    </profile>

    <profile>
      <!-- All modules are built with Java 6 -->
      <id>Java6</id>
      <activation>
        <jdk>1.6</jdk>
      </activation>
      <modules>
        <module>api</module>
        <module>spi</module>
        <module>jlr</module>
        <module>core</module>
        <module>apt</module>
        <module>test-java5</module>
        <module>test-java6</module>
        <module>test</module>
      </modules>
    </profile>

    <profile>
      <!-- Ensure our build is following some maven best practices and the environment is following some constraints -->
      <!-- Controls can be inactivated by adding -P-enforce or -Dskip-enforce in the command line -->
      <id>enforce</id>
      <activation>
        <property>
          <name>!skip-enforce</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <executions>
              <execution>
                <id>enforce-plugin-versions</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireJavaVersion>
                      <message>Reflext requires at least Java 1.5 to build.</message>
                      <version>1.5</version>
                    </requireJavaVersion>
                    <requirePluginVersions>
                      <message>Best practice is to always define plugin versions!</message>
                      <banLatest>true</banLatest>
                      <banRelease>true</banRelease>
                      <phases>deploy,site</phases>
                    </requirePluginVersions>
                    <requireMavenVersion>
                      <!-- Version 2.0.9 started specifying default versions for all core plugins in the super pom. -->
                      <version>2.0.9</version>
                    </requireMavenVersion>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <!-- Generation of a jar containing the source code -->
      <!-- Generation can be inactivated by adding -P-sources or -Dskip-sources in the command line -->
      <id>sources</id>
      <activation>
        <property>
          <name>!skip-sources</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <!-- This profile is used when we are doing a release -->
      <id>release</id>
      <build>
        <plugins>
          <!-- Check that the property for the remote repository lacation is defined -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <executions>
              <execution>
                <id>enforce-plugin-versions</id>
                <goals>
                  <goal>enforce</goal>
                </goals>
                <configuration>
                  <rules>
                    <requireProperty>
                      <property>reflext.distrib.repo.url</property>
                      <message>"You must define the property reflext.distrib.repo.url to give the url where you'll deploy released artifacts"</message>
                    </requireProperty>
                  </rules>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>

</project>
