<?xml version="1.0" encoding="UTF-8"?>
<!--
    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.
	   
-->
<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>

  <name>Apache MyFaces Trinidad Impl</name>
  <description>Private implementation of the Apache MyFaces Trinidad project</description>

  <parent>
    <groupId>org.apache.myfaces.trinidad</groupId>
    <artifactId>trinidad</artifactId>
    <version>2.0.1</version>
  </parent>

  <artifactId>trinidad-impl</artifactId>
  <packaging>jar</packaging>

  <dependencies>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
    </dependency>

    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
    </dependency>

    <dependency>
      <groupId>javax.portlet</groupId>
      <artifactId>portlet-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.myfaces.portlet-bridge</groupId>
      <artifactId>portlet-bridge-api</artifactId>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
    </dependency>

    <!--dependency>
      <groupId>org.apache.myfaces.core</groupId>
      <artifactId>myfaces-api</artifactId>
      <scope>provided</scope> 
    </dependency-->
    
    <dependency>
      <groupId>com.sun.faces</groupId>
      <artifactId>jsf-api</artifactId>
      <scope>provided</scope> 
    </dependency>

    <dependency>
      <groupId>org.apache.myfaces.buildtools</groupId>
      <artifactId>myfaces-builder-annotations</artifactId>
    </dependency>
      
    <dependency>
      <groupId>org.apache.myfaces.trinidad</groupId>
      <artifactId>trinidad-build</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.myfaces.trinidad</groupId>
      <artifactId>trinidad-api</artifactId>
    </dependency>

    <!--dependency>
      <groupId>com.sun.facelets</groupId>
      <artifactId>jsf-facelets</artifactId>
    </dependency-->

    <!-- "test" scope dependencies -->
    <dependency>
      <groupId>org.apache.myfaces.trinidad</groupId>
      <artifactId>trinidad-api</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.shale</groupId>
      <artifactId>shale-test</artifactId>
    </dependency>

    <dependency>
      <groupId>jmock</groupId>
      <artifactId>jmock</artifactId>
    </dependency>

    <dependency>
      <groupId>jmock</groupId>
      <artifactId>jmock-cglib</artifactId>
    </dependency>

    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <scope>test</scope>
    </dependency>

    <!--dependency>
      <groupId>org.apache.myfaces.core</groupId>
      <artifactId>myfaces-impl</artifactId>
      <scope>test</scope>
    </dependency-->

  </dependencies>

  <build>
    <plugins>
      <plugin>
          <groupId>org.apache.myfaces.buildtools</groupId>
          <artifactId>myfaces-builder-plugin</artifactId>
          <executions>
              <execution>
                  <goals>
                      <goal>build-metadata</goal>
                  </goals>
              </execution>
              <!-- TODO: This execution uses myfaces-builder-plugin to generate
              jsp tag classes. Note it only generates component tag classes, not
              converter and validator ones (there are other goals on builder
              plugin to do that). The generated stuff can be compared using a diff
              tool against maven-faces-plugin generated files. For now the intention
              is just test if myfaces-builder-plugin integration is working well and
              it is possible to use it to generate custom components extending from
              trinidad. See TRINIDAD-1409 for details. 
              <execution>
                <id>make_tags</id>
                <configuration>
                    <modelIds>
                        <modelId>trinidad-api</modelId>
                    </modelIds>
                    <jsfVersion>20</jsfVersion>
                    <templateTagName>trinidadTagClass20.vm</templateTagName>
                    <packageContains>org.apache.myfaces.trinidadinternal</packageContains>
                </configuration>
                <goals>
                    <goal>make-tags</goal>
                </goals>
              </execution>
              -->
          </executions>
      </plugin>
          
      <plugin>
        <groupId>org.apache.myfaces.trinidadbuild</groupId>
        <artifactId>maven-jdev-plugin</artifactId>
        <configuration>
          <sourceRoots>
            <sourceRoot>src/main/java-templates/</sourceRoot>
          </sourceRoots>
          <resourceRoots>
            <resourceRoot>src/main/javascript/</resourceRoot>
          </resourceRoots>
          <projectHasTests>true</projectHasTests>
          <testSourceRoots>
            <file>${project.basedir}/src/test</file>
          </testSourceRoots>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <systemProperties>
            <!-- Trinidad currently fails proper HTML ID validity,
		 and rather badly - so turn that test off -->
            <property>
              <name>org.apache.myfaces.trinidad.TestIdValidity</name>
              <value>false</value>
            </property>
            <!-- Trinidad currently puts a lot of block-elements inside
		 of inline elements - so turn that test off too -->
            <property>
              <name>org.apache.myfaces.trinidad.TestBlockElementNesting</name>
              <value>false</value>
            </property>
            <property>
              <name>trinidad.renderkit.fulltests</name>
              <value>lenient</value>
            </property>
            <property>
              <name>trinidad.renderkit.scripts</name>
              <value>${project.basedir}/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/testScripts/</value>
            </property>
            <property>
              <name>trinidad.renderkit.golden</name>
              <value>${project.basedir}/src/test/resources/org/apache/myfaces/trinidadinternal/renderkit/golden/</value>
            </property>
            <property>
              <name>trinidad.renderkit.failures</name>
              <value>${project.basedir}/target/test-failures/</value>
            </property>
            <property>
              <name>java.awt.headless</name>
              <value>true</value>
            </property>
          </systemProperties>
          <includes implementation="java.util.ArrayList">
            <include implementation="java.lang.String">**/*Test.java</include>
          </includes>
        </configuration>
      </plugin>

      <!-- 
          To make the current version of maven available through a property (maven.version),
          the build-helper-maven-plugin can be used.
      -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.5</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>maven-version</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- 
          To make the current revision number, we use the buildnumber-maven-plugin.
      -->
      <!--plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <version>1.0-beta-4</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>create</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <doCheck>false</doCheck>
          <doUpdate>false</doUpdate>
          <getRevisionOnlyOnce>true</getRevisionOnlyOnce>
          <buildNumberPropertyName>scm.revision</buildNumberPropertyName>
        </configuration>
      </plugin-->

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
         <archive>
           <manifest>
             <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
             <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
           </manifest>
           <manifestEntries>
             <Revision>${scm.revision}</Revision>
             <Maven-Version>${maven.version}</Maven-Version>
             <Java-Vendor>${java.vendor}</Java-Vendor>
             <Os-Name>${os.name}</Os-Name>
             <Os-Arch>${os.arch}</Os-Arch>
             <Os-Version>${os.version}</Os-Version>
           </manifestEntries>
         </archive>
       </configuration>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.myfaces.trinidadbuild</groupId>
        <artifactId>maven-faces-plugin</artifactId>
        <configuration>
          <taglibs>
            <tr>http://myfaces.apache.org/trinidad</tr>
            <trh>http://myfaces.apache.org/trinidad/html</trh>
          </taglibs>
          <faceletHandlerClass>org.apache.myfaces.trinidadinternal.facelets.TrinidadComponentHandler</faceletHandlerClass>
          <faceletConverterHandlerClass>org.apache.myfaces.trinidadinternal.facelets.TrinidadConverterHandler</faceletConverterHandlerClass>
          <faceletValidatorHandlerClass>org.apache.myfaces.trinidadinternal.facelets.TrinidadValidatorHandler</faceletValidatorHandlerClass>
          <typePrefix>org.apache</typePrefix>
          <renderKitPrefix>org.apache</renderKitPrefix>
          <packageContains>org.apache</packageContains>
          <removeRenderers>true</removeRenderers>
          <jsfVersion>${jsf-spec.version}</jsfVersion>
          <force>true</force>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>generate-faces-config</goal>
              <goal>generate-jsp-taglibs</goal>
              <goal>generate-facelets-taglibs</goal>
              <goal>generate-renderer-map</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.myfaces.trinidadbuild</groupId>
        <artifactId>maven-i18n-plugin</artifactId>
        <configuration>
          <force>true</force>
          <targetPath>META-INF/adf/jsLibs/resources</targetPath>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>generate-locale-elements</goal>
              <goal>generate-javascript-locales</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.myfaces.trinidadbuild</groupId>
        <artifactId>maven-javascript-plugin</artifactId>
        <configuration>
          <sourcePath>META-INF/adf/jsLibs</sourcePath>
          <targetPath>META-INF/adf/jsLibsDebug</targetPath>
          <optimizeTargetPath>META-INF/adf/jsLibs</optimizeTargetPath>
          <force>true</force>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>reduce-javascript</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.myfaces.trinidadbuild</groupId>
        <artifactId>maven-xrts-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>generate-sources</goal>
              <goal>generate-test-sources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-site-plugin</artifactId>
        <configuration>
          <reportPlugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-project-info-reports-plugin</artifactId>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-pmd-plugin</artifactId>
              <version>2.6</version>
              <configuration>
                <targetJdk>${jdk.version}</targetJdk>
              </configuration>
            </plugin>
          </reportPlugins>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <configuration>
          <excludes>
            <!-- Excludes the Golden files -->
            <exclude>src/test/resources/*/</exclude>
            <exclude>src/main/resources/META-INF/trinidad-version.txt</exclude>
            <exclude>src/main/resources/META-INF/servlets/resources/adf.resources</exclude>
          </excludes>
        </configuration>
      </plugin>

    </plugins>    
  </build>
</project>
