<!--
  Copyright 2012, Apache Software Foundation
  
  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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <!-- Setup Sonatype OSS deployment mechanism -->
  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>5</version>
  </parent>
  
  <groupId>org.commonjava.maven</groupId>
  <artifactId>maven-model-jdom-support</artifactId>
  <version>3.0.x-1.2</version>

  <name>maven-model-jdom-support</name>

  <scm>
    <connection>scm:git:http://jdcasey@github.com/jdcasey/maven-model-jdom-support.git</connection>
    <developerConnection>scm:git:git@github.com:jdcasey/maven-model-jdom-support.git</developerConnection>
    <url>http://github.com/jdcasey/maven-model-jdom-support</url>
  </scm>
  
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <mavenVersion>3.0.3</mavenVersion>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.jdom</groupId>
      <artifactId>jdom</artifactId>
      <version>1.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-model</artifactId>
      <version>${mavenVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-repository-metadata</artifactId>
      <version>${mavenVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-settings</artifactId>
      <version>${mavenVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
      <version>${mavenVersion}</version>
    </dependency>
  </dependencies>
  
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-remote-resources-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>process</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <resourceBundles>
                <resourceBundle>org.apache:apache-jar-resource-bundle:1.4</resourceBundle>
              </resourceBundles>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-gpg-plugin</artifactId>
          <version>1.0-alpha-4</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-source-plugin</artifactId>
          <version>2.1.1</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  
  <profiles>
    <profile>
      <id>sonatype-oss-release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <configuration>
              <passphrase>${gpg.passphrase}</passphrase>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <encoding>${project.build.sourceEncoding}</encoding>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>generate</id>
      
      <dependencies>
        <dependency>
          <groupId>org.apache.maven</groupId>
          <artifactId>apache-maven</artifactId>
          <version>${mavenVersion}</version>
          <type>zip</type>
          <classifier>src</classifier>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.1</version>
            <executions>
              <execution>
                <id>unpack-maven-mdo</id>
                <phase>generate-sources</phase>
                <goals>
                  <goal>unpack-dependencies</goal>
                </goals>
                <configuration>
                  <includeArtifactIds>apache-maven</includeArtifactIds>
                  <includeGroupIds>org.apache.maven</includeGroupIds>
                  <includeClassifiers>src</includeClassifiers>
                  <includeTypes>zip</includeTypes>
                  <includes>**/*.mdo</includes>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.modello</groupId>
            <artifactId>modello-maven-plugin</artifactId>
            <version>1.4.1</version>
            <configuration>
              <useJava5>true</useJava5>
              <outputDirectory>src/main/java</outputDirectory>
            </configuration>
            <executions>
              <execution>
                <id>toolchains</id>
                <phase>process-sources</phase>
                <goals>
                  <goal>jdom-writer</goal>
                </goals>
                <configuration>
                  <version>1.0.0</version>
                  <models>
                    <model>target/dependency/apache-maven-${mavenVersion}/maven-core/src/main/mdo/toolchains.mdo</model>
                  </models>
                </configuration>
              </execution>
              <execution>
                <id>pom</id>
                <phase>process-sources</phase>
                <goals>
                  <goal>jdom-writer</goal>
                </goals>
                <configuration>
                  <version>4.0.0</version>
                  <models>
                    <model>target/dependency/apache-maven-${mavenVersion}/maven-model/src/main/mdo/maven.mdo</model>
                  </models>
                </configuration>
              </execution>
              <execution>
                <id>repository-metadata</id>
                <phase>process-sources</phase>
                <goals>
                  <goal>jdom-writer</goal>
                </goals>
                <configuration>
                  <version>1.1.0</version>
                  <models>
                    <model>target/dependency/apache-maven-${mavenVersion}/maven-repository-metadata/src/main/mdo/metadata.mdo</model>
                  </models>
                </configuration>
              </execution>
              <execution>
                <id>settings</id>
                <phase>process-sources</phase>
                <goals>
                  <goal>jdom-writer</goal>
                </goals>
                <configuration>
                  <version>1.1.0</version>
                  <models>
                    <model>target/dependency/apache-maven-${mavenVersion}/maven-settings/src/main/mdo/settings.mdo</model>
                  </models>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
