<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">
<!--
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you 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.
-->
  <parent>
    <artifactId>myfaces-shared-project</artifactId>
    <groupId>org.apache.myfaces.shared</groupId>
    <version>4.1.16-SNAPSHOT</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <artifactId>myfaces-shared-core</artifactId>
  <packaging>jar</packaging>
  <name>Apache MyFaces Shared For JSF 2.1 - Core Mirror</name>
  <description>The MyFaces Shared Core Subproject build the sources artifact
    needed by the shared-* modules</description>

  <scm>
    <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/shared/trunk_4.1.x/core</connection>
    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/shared/trunk_4.1.x/core</developerConnection>
    <url>http://svn.apache.org/viewcvs.cgi/myfaces/shared/trunk_4.1.x/core</url>
  </scm>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.5</version>
        <executions>
          <execution>
            <id>add-resource</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>add-resource</goal>
            </goals>
            <configuration>
              <resources>
                <resource>
                  <directory>${project.build.directory}/generated-resources/myfaces-javascript-plugin/</directory>
               </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>    
      <plugin>
          <artifactId>myfaces-javascript-plugin</artifactId>
          <groupId>org.apache.myfaces.buildtools</groupId>
          <version>1.0.1</version>
          <extensions>true</extensions>
          <executions>
               <execution>
                  <id>compile-myfacesscripts</id>
                  <goals>
                      <goal>compile</goal>
                  </goals>
                  <phase>generate-resources</phase>
                  <configuration>
                      <descriptor>${basedir}/src/assembler/myfacesscripts-compiler.xml</descriptor>
                      <outputDirectory>${project.build.directory}/generated-resources/myfaces-javascript-plugin/META-INF/resources/org.apache.myfaces/</outputDirectory>
                  </configuration>
              </execution>
              <execution>
                  <id>compile-myfacesscripts-uncompressed</id>
                  <goals>
                      <goal>compile</goal>
                  </goals>
                  <phase>generate-resources</phase>
                  <configuration>
                      <descriptor>${basedir}/src/assembler/myfacesscripts-uncompressed-compiler.xml</descriptor>
                      <outputDirectory>${project.build.directory}/generated-resources/myfaces-javascript-plugin/META-INF/internal-resources/org.apache.myfaces/</outputDirectory>
                  </configuration>
              </execution>
              <execution>
                  <id>compress-myfacesscripts</id>
                  <goals>
                      <goal>compress</goal>
                  </goals>
                  <phase>generate-resources</phase>
                  <configuration>
                      <scripts>target/generated-resources/myfaces-javascript-plugin/META-INF/resources/org.apache.myfaces/</scripts>
                      <excludes>
                          <exclude>oamSubmit-uncompressed.js</exclude>
                      </excludes>
                      <compressor>yahooUI</compressor>
                  </configuration>
              </execution>
          </executions>
          <configuration>
              <optimizationLevel>0</optimizationLevel>
              <sourceDirectory>src/main/javascript</sourceDirectory>
              <webappDirectory>${basedir}</webappDirectory>
              <outputDirectory>${project.build.directory}/generated-resources/myfaces-javascript-plugin/META-INF/resources/org.apache.myfaces/</outputDirectory>
          </configuration>
      </plugin>
      
      <!-- 
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.1.2</version>
        <configuration>
          <excludes>
            <exclude>**/*StateUtilsAES_CBCTest*</exclude>
          </excludes>
        </configuration>
      </plugin>
       -->
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-source</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  
  <profiles>
    <!-- This profile synchronize the code inside myfaces core with the code hosted here.
         To execute just type mvn install -Dsynch-shared=true and then just commit the changes.
         Before each release remember comment this profile or point the shared reference to a non
         snapshot version, so release plugin continue working. -->
    <profile>
      <id>synch-myfaces-impl-shared</id>
      <properties>
        <myfaces.impl.shared.version>2.1.18-SNAPSHOT</myfaces.impl.shared.version>
      </properties>
      <activation>
        <property>
            <name>synch-shared</name>
            <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>unpack-sources</id>
                <phase>generate-sources</phase>
                <goals><goal>unpack</goal></goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                       <groupId>org.apache.myfaces.core.internal</groupId>
                       <artifactId>myfaces-impl-shared</artifactId>
                       <version>${myfaces.impl.shared.version}</version>
                       <type>jar</type>
                       <classifier>sources</classifier>
                     </artifactItem>
                   </artifactItems>
                   <includes>**/*.java</includes>
                   <outputDirectory>${basedir}/src/main/java</outputDirectory>
                </configuration>
              </execution>
              <execution>
                <id>unpack-resources</id>
                <phase>generate-sources</phase>
                <goals><goal>unpack</goal></goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                       <groupId>org.apache.myfaces.core.internal</groupId>
                       <artifactId>myfaces-impl-shared</artifactId>
                       <version>${myfaces.impl.shared.version}</version>
                       <type>jar</type>
                       <classifier>sources</classifier>
                     </artifactItem>
                   </artifactItems>
                   <includes>META-INF/myfaces-metadata.xml</includes>
                   <outputDirectory>${basedir}/src/main/resources</outputDirectory>
                </configuration>
              </execution>              
              <execution>
                <id>unpack-resources-sources</id>
                <phase>generate-sources</phase>
                <goals><goal>unpack</goal></goals>
                <configuration>
                  <overWriteReleases>true</overWriteReleases>
                  <overWriteSnapshots>true</overWriteSnapshots>
                  <artifactItems>
                    <artifactItem>
                       <groupId>org.apache.myfaces.core.internal</groupId>
                       <artifactId>myfaces-impl-shared</artifactId>
                       <version>${myfaces.impl.shared.version}</version>
                       <type>jar</type>
                     </artifactItem>
                   </artifactItems>
                   <includes>META-INF/internal-resources/**,META-INF/resources/**</includes>
                   <outputDirectory>${project.build.directory}/refactored-shared-sources/main/resources</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
              <artifactId>maven-antrun-plugin</artifactId>
              <executions>
                  <execution>
                      <id>copy-javascript-files</id>
                      <phase>generate-resources</phase>
                      <configuration>
                          <tasks>
                              <copy file="${project.build.directory}/refactored-shared-sources/main/resources/META-INF/internal-resources/org.apache.myfaces/oamSubmit-uncompressed.js" tofile="${basedir}/src/main/javascript/META-INF/resources/myfaces/_impl/oamSubmit.js" overwrite="true" verbose="true" failonerror="true" />
                          </tasks>
                      </configuration>
                      <goals>
                          <goal>run</goal>
                      </goals>
                  </execution>
              </executions>
          </plugin>        
        </plugins>
      </build>
    </profile>
  </profiles>
  
  <reporting>
    <plugins>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.0</version>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>changelog-maven-plugin</artifactId>
        <version>2.0-beta-1</version>
        <reportSets>
          <reportSet>
            <id>dual-report</id>
            <configuration>
              <type>range</type>
              <range>30</range>
            </configuration>
            <reports>
              <report>changelog</report>
              <report>file-activity</report>
              <report>dev-activity</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jxr-maven-plugin</artifactId>
      </plugin>
      <!-- 
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>surefire-report-maven-plugin</artifactId>
      </plugin>
       -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>taglist-maven-plugin</artifactId>
        <version>2.0</version>
      </plugin>
      <plugin>
        <artifactId>maven-pmd-plugin</artifactId>
        <version>2.2</version>
        <configuration>
          <rulesets>
            <ruleset>/rulesets/basic.xml</ruleset>
            <ruleset>/rulesets/unusedcode.xml</ruleset>
          </rulesets>
          <linkXref>true</linkXref>
          <minimumTokens>100</minimumTokens>
          <targetJdk>1.5</targetJdk>
          <excludes>
            <!-- these class make the PMD plugin crash (NullPointerException). -->
            <exclude>org/apache/myfaces/el/convert/PropertyResolverToELResolver.java</exclude>
            <exclude>org/apache/myfaces/el/PropertyResolverImpl.java</exclude>
          </excludes>
        </configuration>
        <reportSets>
          <reportSet>
            <reports>
              <report>pmd</report>
              <report>cpd</report>
            </reports>
          </reportSet>
        </reportSets>
      </plugin>
    </plugins>
  </reporting>
</project>
