<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.apache.myfaces.shared</groupId>
    <artifactId>myfaces-shared-project</artifactId>
    <version>3.0.5</version>
  </parent>

  <artifactId>myfaces-shared-impl</artifactId>
  <packaging>jar</packaging>
  <name>MyFaces Shared Impl</name>
  <description>Shared project renamed for use in MyFaces Impl</description>

  <scm>
    <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/shared/branches/3_0_5/shared-impl</connection>
    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/shared/branches/3_0_5/shared-impl</developerConnection>
    <url>http://svn.apache.org/viewcvs.cgi/myfaces/shared/branches/3_0_5/shared-impl</url>
  </scm>

  <build>

    <resources>
      <resource>
        <!-- because adding an additional resourceRoot not possible with antrun yet -->
        <directory>target/refactored-shared-sources/main/resources</directory>
      </resource>
    </resources>

    <plugins>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>dependency-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-sources</id>
            <phase>generate-sources</phase>
            <goals><goal>unpack</goal></goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                   <groupId>org.apache.myfaces.shared</groupId>
                   <artifactId>myfaces-shared-core</artifactId>
                   <version>${project.version}</version>
                   <type>jar</type>
                   <classifier>sources</classifier>
                 </artifactItem>
               </artifactItems>
               <outputDirectory>${project.build.directory}/unpacked-shared-sources</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>refactor-shared-sources</id>
            <phase>process-sources</phase>
            <configuration>
              <tasks>
                  <property name="refactor.src.dir" value="${project.build.directory}/unpacked-shared-sources" />
                  <property name="refactor.output.dir" value="${project.build.directory}/refactored-shared-sources/main/java" />
                  <property name="refactor.package.new" value="shared_impl" />
                  <ant dir="${project.basedir}" antfile="build.xml" inheritRefs="true" inheritAll="true">
                    <target name="refactor-java-sources" />
                  </ant>
              </tasks>
              <sourceRoot>${project.build.directory}/refactored-shared-sources/main/java</sourceRoot>
            </configuration>
            <goals><goal>run</goal></goals>
          </execution>
          <execution>
            <id>refactor-resources</id>
            <phase>generate-resources</phase>
            <configuration>
              <tasks>
                  <property name="refactor.src.dir" value="${project.build.directory}/unpacked-shared-sources" />
                  <property name="refactor.output.dir" value="${project.build.directory}/refactored-shared-sources/main/resources" />
                  <property name="refactor.package.new" value="shared_impl" />
                  <ant dir="${project.basedir}" antfile="build.xml" inheritRefs="true" inheritAll="true">
                    <target name="refactor-resources" />
                  </ant>
              </tasks>
              <resourceRoot>${project.build.directory}/refactored-shared-sources/main/resources</resourceRoot> <!-- not yet supported -->
            </configuration>
            <goals><goal>run</goal></goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-source</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>

  </build>

  <dependencies>
    <dependency>
      <groupId>org.apache.myfaces.shared</groupId>
      <artifactId>myfaces-shared-core</artifactId>
      <scope>provided</scope>
    </dependency>
  </dependencies>


</project>
