<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>com.sun.faces</groupId>
    <artifactId>jsf-project</artifactId>
    <version>2.2.13.SP5</version>
  </parent>

  <groupId>com.sun.faces</groupId>
  <artifactId>jsf-impl</artifactId>
  <packaging>jar</packaging>

  <name>JSF Reference Implementation</name>
  <description>JSF (JSR 314) Reference Implementation</description>

  <scm>
    <connection>scm:git:git@github.com:jboss/mojarra.git</connection>
    <developerConnection>scm:git:git@github.com:jboss/mojarra.git</developerConnection>
    <url>https://github.com/jboss/mojarra.git</url>
    <tag>2.2.13.SP5</tag>
  </scm>

  <dependencies>
    <dependency>
      <groupId>org.jboss.spec.javax.faces</groupId>
      <artifactId>jboss-jsf-api_2.2_spec</artifactId>
      <version>2.2.13</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
   <sourceDirectory>xxx</sourceDirectory>
   <testSourceDirectory>xxx/test</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals> 
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <delete dir="${project.build.outputDirectory}/jar-main" />
                <unzip src="${project.basedir}/build/lib/jboss-jsf-impl.jar" dest="${project.build.outputDirectory}/jar-main">
                  <patternset>
                    <exclude name="javax/**" />
                  </patternset>
                </unzip>
                <delete dir="${project.build.outputDirectory}/jar-sources" />
                <unzip src="${project.basedir}/dist/jsf-ri-src-${project.version}.zip" dest="${project.build.outputDirectory}/jar-sources">
                  <patternset>
                    <exclude name="**/conf/**" />
                  </patternset>
                </unzip>
              </target>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>com.sun</groupId>
            <artifactId>tools</artifactId>
            <version>1.7.0</version>
            <scope>system</scope>
            <systemPath>${java.home}/../lib/tools.jar</systemPath>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>repack-jar</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classesDirectory>${project.build.outputDirectory}/jar-main</classesDirectory>
              <forceCreation>true</forceCreation>
              <archive>
                <manifestFile>${project.build.outputDirectory}/jar-main/META-INF/MANIFEST.MF</manifestFile>
              </archive>
            </configuration>
          </execution>
          <execution>
            <id>repack-jar-sources</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classesDirectory>${project.build.outputDirectory}/jar-sources/jsf-ri-src-${project.version}/src</classesDirectory>
              <classifier>sources</classifier>
              <forceCreation>true</forceCreation>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>javadoc</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>package-javadoc</id>
                <phase>package</phase>
                <configuration>
                  <target>
                    <delete dir="${project.build.outputDirectory}/jar-javadoc" />
                    <unzip src="${project.basedir}/dist/jsf-ri-javadocs-${project.version}.zip" dest="${project.build.outputDirectory}/jar-javadoc" />
                  </target>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <executions>
              <execution>
                <id>repack-jar-javadoc</id>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <classesDirectory>${project.build.outputDirectory}/jar-javadoc/jsf-ri-${project.version}/javadocs</classesDirectory>
                  <classifier>javadoc</classifier>
                  <forceCreation>true</forceCreation>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
