<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>

  <groupId>org.apache.myfaces.tomahawk</groupId>
  <artifactId>tomahawk21</artifactId>
  <packaging>jar</packaging>
  <name>Tomahawk 2.1 Core</name>
  <description>
    JSF components and utilities that can be used with any JSF implementation.
    This library is based on the JSF1.1 version of Tomahawk, but with minor source code and build
    changes to take advantage of JSF2.1 features. A JSF2.1 implementation is required to use this
    version of the Tomahawk library.
  </description>

  <parent>
    <groupId>org.apache.myfaces.tomahawk</groupId>
    <artifactId>tomahawk-project</artifactId>
    <version>1.1.14</version>
  </parent>

  <scm>
    <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/tomahawk/tags/tomahawk-project-1.1.14/core21</connection>
    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/tomahawk/tags/tomahawk-project-1.1.14/core21</developerConnection>
    <url>http://svn.apache.org/viewcvs.cgi/myfaces/tomahawk/tags/tomahawk-project-1.1.14/core21</url>
  </scm>

  <dependencies>

    <!-- compile dependencies -->

    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <scope>compile</scope>
    </dependency>
    

    <dependency>
      <groupId>commons-validator</groupId>
      <artifactId>commons-validator</artifactId>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>commons-fileupload</groupId>
      <artifactId>commons-fileupload</artifactId>
      <scope>compile</scope>
    </dependency>

    <!-- Transitive dependency from commons-fileupload.
    in 2.0 it was declared optional, but t:inputFileUpload
    uses it indirectly, so it is necessary to include it
    in our pom as runtime dependency  -->
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>commons-collections</groupId>
      <artifactId>commons-collections</artifactId>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>struts</groupId>
      <artifactId>struts</artifactId>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>

    <dependency>
      <groupId>org.apache.tiles</groupId>
      <artifactId>tiles-core</artifactId>
      <scope>compile</scope>
      <optional>true</optional>        
    </dependency>

    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>oro</groupId>
      <artifactId>oro</artifactId>
      <scope>compile</scope>
    </dependency>

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

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>batik</groupId>
      <artifactId>batik-awt-util</artifactId>
    </dependency>   
      
    <!-- provided dependencies -->

    <dependency>
      <groupId>org.apache.myfaces.core</groupId>
      <artifactId>myfaces-api</artifactId>
      <version>${myfaces-core21-version}</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.myfaces.shared</groupId>
      <artifactId>myfaces-shared-tomahawk</artifactId>
      <version>${myfaces-shared21-version}</version>
      <scope>provided</scope> <!-- because we add all classes to the jar directly -->
    </dependency>

    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.1</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>portlet-api</groupId>
      <artifactId>portlet-api</artifactId>
      <version>1.0</version>
      <scope>provided</scope>
    </dependency>
    
    <dependency>
      <groupId>org.apache.myfaces.buildtools</groupId>
      <artifactId>myfaces-builder-annotations</artifactId> 
      <version>${myfaces-builder-annotations-version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- test dependencies -->

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.myfaces.core</groupId>
      <artifactId>myfaces-impl</artifactId>
      <version>${myfaces-core21-version}</version>
      <!--
        Since Tomahawk must stay compatible to other JSF implementations we
        must not have any (compile time) dependency on myfaces-impl other than
        test classes.
      -->
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>joda-time</groupId>
      <artifactId>joda-time</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>cactus</groupId>
      <artifactId>cactus</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjrt</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>easymock</groupId>
      <artifactId>easymock</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>easymock</groupId>
      <artifactId>easymockclassextension</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.myfaces.test</groupId>
      <artifactId>myfaces-test20</artifactId>
      <scope>test</scope>
    </dependency>
    
    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-validation_1.0_spec</artifactId>
        <version>1.1</version>
        <scope>test</scope>
        <optional>true</optional>
    </dependency>
    
    <dependency>
        <groupId>commons-digester</groupId>
        <artifactId>commons-digester</artifactId>
        <version>1.8</version>
        <scope>test</scope>
    </dependency>
    
    <dependency>
      <groupId>jmock</groupId>
      <artifactId>jmock</artifactId>
      <scope>test</scope>
    </dependency>

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

    <dependency>
      <groupId>maven-taglib</groupId>
      <artifactId>maven-taglib-plugin</artifactId>
      <scope>test</scope>
    </dependency>   

  </dependencies>

  <build>

    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <excludes>
           <exclude>**/*.vm</exclude>
        </excludes>
      </resource>
      <!--       
      <resource>
        <directory>src/main/resources-facesconfig</directory>
      </resource>
       -->
      <resource>
        <directory>target/tomahawk20_resources</directory>
      </resource>       
    </resources>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <archive>
              <manifestEntries>
                <X-Compile-Source-JDK>1.5</X-Compile-Source-JDK>
                <X-Compile-Target-JDK>1.5</X-Compile-Target-JDK>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <!-- 
          - Add two new source directories to the compile path. Other plugins will write files into
          - those directories. Note that when building the source jars, these directories are
          - automatically used too.
          -
          - * shared_sources: contains code from the 2.0.x branch of the myfaces-shared project
          - * tomahawk20_sources: contains all the source code from the "main" branch of tomahawk,
          -   which is written to be JSF1.1-compatible.
          -->
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
            <execution>
                <id>add-source</id>
                <phase>generate-sources</phase>
                <!-- <phase>process-sources</phase> -->
                <goals>
                    <goal>add-source</goal>
                </goals>
                <configuration>
                    <sources>
                        <source>
                            ${project.build.directory}/shared_sources
                        </source>
                        <source>
                            ${project.build.directory}/tomahawk20_sources
                        </source>
                    </sources>
                </configuration>
            </execution>
        </executions>
      </plugin>    
      <plugin>
        <groupId>org.apache.myfaces.buildtools</groupId>
        <artifactId>myfaces-builder-plugin</artifactId>
        <version>${myfaces-builder-plugin-version}</version>
        <executions>
          <execution>
            <id>unpack-tomahawk</id>
            <phase>generate-sources</phase>
            <!-- <phase>process-resources</phase> -->
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <scanModel>true</scanModel>
              <artifactItems>
                <artifactItem>
                  <groupId>org.apache.myfaces.tomahawk</groupId>
                  <artifactId>tomahawk20</artifactId>
                  <version>${pom.version}</version>
                  <classifier>sources</classifier>                   
                  <!-- <outputDirectory>${project.build.directory}/unpacktomahawksources</outputDirectory> -->
                  <outputDirectory>${project.build.directory}/tomahawk20_sources</outputDirectory>
                  <includes>**/*.java</includes>
                  <excludes>**/*.class,**/META-INF/*,
                  org/apache/myfaces/shared_tomahawk/**/*.java,
                  org/apache/myfaces/custom/dojo/**,
                  org/apache/myfaces/custom/dojoextensions/**,
                  org/apache/myfaces/taglib/html/ext/**</excludes>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
          <execution>
            <id>unpack-tomahawk-resources</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <baseDirectory1>${basedir}/src/main/resources</baseDirectory1>
              <artifactItems>
                <artifactItem>
                  <groupId>org.apache.myfaces.tomahawk</groupId>
                  <artifactId>tomahawk20</artifactId>
                  <version>${pom.version}</version>                                   
                  <outputDirectory>${project.build.directory}/tomahawk20_resources</outputDirectory>
                  <excludes>**/*.class,**/META-INF/*</excludes>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
          <execution>
            <!-- A hierarchy of different tag classes must be created, 
            because this classes are not part of the public api. The
            generation of all html package is the same. Please note that
            we need only a subset -->
            <configuration>
                <replacePackagePrefixTagFrom>org.apache.myfaces.taglib</replacePackagePrefixTagFrom>
                <replacePackagePrefixTagTo>org.apache.myfaces.shared_tomahawk.taglib</replacePackagePrefixTagTo>
            </configuration>
            <goals>
              <goal>build-metadata</goal>
            </goals>
          </execution>
          <execution>
            <id>makefacesconfig</id>
            <configuration>
                <templateFile>faces-config20.vm</templateFile>
                <xmlFile>META-INF/faces-config.xml</xmlFile>
            </configuration>
            <goals>
                <goal>make-config</goal>
            </goals>
          </execution>
          <execution>
            <id>makecomp</id>
            <goals>
              <goal>make-components</goal>
            </goals>
            <configuration>
               <jsfVersion>20</jsfVersion>
               <templateComponentName>componentClass20.vm</templateComponentName>
               <mainSourceDirectory2>${project.build.directory}/tomahawk20_sources</mainSourceDirectory2>
            </configuration>
          </execution>          
          <execution>
            <id>makeval</id>
            <goals>
              <goal>make-validators</goal>
            </goals>
            <configuration>
               <jsfVersion>12</jsfVersion>
               <templateValidatorName>validatorClass12.vm</templateValidatorName>
               <mainSourceDirectory2>${project.build.directory}/tomahawk20_sources</mainSourceDirectory2>
            </configuration>
          </execution>
          <execution>
            <id>make_tags_myfaces_core</id>
            <configuration>
                <packageContains>org.apache.myfaces.shared_tomahawk.taglib</packageContains>
                <typePrefix>javax.faces</typePrefix>
                <modelIds>
                    <!-- All the info needed is on myfaces-api package -->
                    <modelId>myfaces-api</modelId>
                </modelIds>
                <jsfVersion>12</jsfVersion>
                <templateTagName>tagClass12.vm</templateTagName>
            </configuration>
            <goals>
                <goal>make-tags</goal>
            </goals>
          </execution>
          <execution>
            <id>make_tags_tomahawk</id>
            <configuration>
               <jsfVersion>12</jsfVersion>
               <templateTagName>tagClass12.vm</templateTagName>
               <mainSourceDirectory2>${project.build.directory}/tomahawk20_sources</mainSourceDirectory2>
            </configuration>            
            <goals>
                <goal>make-tags</goal>
            </goals>
          </execution>
          <execution>
            <id>make_validator_tags_tomahawk</id>
            <configuration>
               <jsfVersion>12</jsfVersion>
               <mainSourceDirectory2>${project.build.directory}/tomahawk20_sources</mainSourceDirectory2>
            </configuration>            
            <goals>
                <goal>make-validator-tags</goal>
                <goal>make-converter-tags</goal>
            </goals>
          </execution>          
          <execution>
            <id>maketomahawktld</id>
            <configuration>
                <xmlFile>META-INF/tomahawk.tld</xmlFile>
                <xmlBaseFile>src/main/conf/META-INF/tomahawk-base.tld</xmlBaseFile>
                <templateFile>tld-tomahawk20.vm</templateFile>
                <params>
                   <shortname>t</shortname>
                   <uri>http://myfaces.apache.org/tomahawk</uri>
                   <displayname>Tomahawk tag library 2.0.</displayname>
                   <description> MyFaces subproject that contains components and other goodies to be used with any JSF implementation.</description>
                </params>
                <modelIds>
                    <modelId>tomahawk21</modelId>
                </modelIds>
            </configuration>
            <goals>
                <goal>make-config</goal>
            </goals>
          </execution>
          <execution>
            <id>make_tomahawk_facelets_tld</id>
            <configuration>
                <outputDirectory>${project.build.directory}/tlddoc-facelets</outputDirectory>
                <xmlFile>tomahawk_facelets.tld</xmlFile>
                <xmlBaseFile>src/main/conf/META-INF/tomahawk-base.tld</xmlBaseFile>
                <templateFile>tld-facelets-tomahawk20.vm</templateFile>
                <params>
                   <shortname>t</shortname>
                   <uri>http://myfaces.apache.org/tomahawk</uri>
                   <displayname>Tomahawk tag library 2.0.</displayname>
                   <description> MyFaces subproject that contains components and other goodies to be used with any JSF implementation.</description>
                </params>
                <modelIds>
                    <modelId>tomahawk21</modelId>
                </modelIds>
            </configuration>
            <goals>
                <goal>make-config</goal>
            </goals>
          </execution>
          <execution>
            <id>maketomahawktaglib</id>
            <configuration>
                <xmlFile>META-INF/tomahawk.taglib.xml</xmlFile>
                <xmlBaseFile>src/main/conf/META-INF/facelets-taglib-base.xml</xmlBaseFile>
                <templateFile>facelets-taglib20.vm</templateFile>
                <params>
                   <shortname>t</shortname>
                   <uri>http://myfaces.apache.org/tomahawk</uri>
                   <compositeLibrary>org.apache.myfaces.custom</compositeLibrary>
                </params>
                <modelIds>
                    <modelId>tomahawk21</modelId>
                </modelIds>
            </configuration>
            <goals>
                <goal>make-config</goal>
            </goals>
          </execution>        
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.5</version>
        <configuration>
          <excludes>
            <exclude>**/Abstract*.java</exclude>
            <exclude>**/*HtmlDateRendererTest*</exclude>
            <exclude>**/TestUtils.java</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.0</version>
        <executions>
          <execution>
            <id>unpack-shared-tomahawk</id>
            <phase>process-classes</phase>
            <goals><goal>unpack</goal></goals>
            <configuration>
              <excludes>META-INF/*.*</excludes>
              <artifactItems>
                <artifactItem>
                   <groupId>org.apache.myfaces.shared</groupId>
                   <artifactId>myfaces-shared-tomahawk</artifactId>
                   <version>${myfaces-shared20-version}</version>
                 </artifactItem>
               </artifactItems>
               <outputDirectory>${project.build.directory}/classes</outputDirectory>
            </configuration>
          </execution>
          <!-- unpack the shared sources into target/shared_sources-->
          <execution>
            <id>unpack-shared-impl-sources</id>
            <phase>process-sources</phase>
            <goals>
                <goal>unpack</goal>
            </goals>
            <configuration>
                <excludes>META-INF/*.*</excludes>
                <artifactItems>
                    <artifactItem>
                        <groupId>org.apache.myfaces.shared</groupId>
                        <artifactId>myfaces-shared-tomahawk</artifactId>
                        <version>${myfaces-shared20-version}</version>
                        <classifier>sources</classifier>
                    </artifactItem>
                </artifactItems>
                <outputDirectory>${project.build.directory}/shared_sources</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>myfaces-javascript-plugin</artifactId>
        <groupId>org.apache.myfaces.buildtools</groupId>
        <version>1.0.2</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>compile</id>
            <goals>
                <goal>compile</goal>
            </goals>
            <phase>process-resources</phase>
            <configuration>
                <descriptor>${basedir}/src/assembler/scripts-compiler.xml</descriptor>
                <sourceDirectory>src/main/javascript</sourceDirectory>
                <outputDirectory>${basedir}/target/classes/META-INF/uncompressed-js-resources</outputDirectory>
            </configuration>
          </execution>
          <execution>
              <id>directory-compress</id>
              <goals>
                  <goal>directory-compress</goal>
              </goals>
              <phase>process-resources</phase>
              <configuration>
                  <optimizationLevel>0</optimizationLevel>
                  <compressor>yahooUI</compressor>
                  <sourceDirectory>${basedir}/target/classes/META-INF/uncompressed-js-resources</sourceDirectory>
                  <outputDirectory>${basedir}/target/classes/META-INF/resources</outputDirectory>
              </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-source</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>

    </plugins>

  </build>

  <reporting>

    <plugins>

      <plugin>
        <artifactId>maven-changelog-plugin</artifactId>
        <version>2.2</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>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.8</version>
      </plugin>

      <plugin>
        <artifactId>maven-jxr-plugin</artifactId>
        <version>2.3</version>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>taglist-maven-plugin</artifactId>
        <version>2.0</version>
      </plugin>

      <plugin>
        <artifactId>maven-surefire-report-plugin</artifactId>
        <version>2.5</version>
      </plugin>
      <!-- This plugin is reffered on myfaces master pom, but
           this is needed to set targetJdk to 1.5 -->
           <!--
      <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>
        </configuration>
      </plugin>
      -->
    </plugins>

  </reporting>

  <profiles>
    <profile>
      <id>generate-site</id>
      <build>
        <plugins>
          <plugin>
            <!-- Generate content for custom tagdoc report -->
            <groupId>org.apache.myfaces.buildtools</groupId>
            <artifactId>myfaces-builder-plugin</artifactId>
            <version>${myfaces-builder-plugin-version}</version>
            <configuration>
              <taglibs>
                <t>http://myfaces.apache.org/tomahawk</t>
              </taglibs>
            </configuration>
            <executions>
              <execution>
                <goals><goal>tagdoc-content</goal></goals>
              </execution>
            </executions>
          </plugin>          
        </plugins>
      </build>
      <reporting>
        <plugins>
          <plugin>
            <groupId>net.sourceforge.maven-taglib</groupId>
            <artifactId>maven-taglib-plugin</artifactId>
            <version>2.4</version>
            <configuration>
              <!-- taglib.src.dir>${basedir}/target/classes/META-INF</taglib.src.dir -->
              <taglib.src.dir>${basedir}/target/tlddoc-facelets</taglib.src.dir>
              <tldDocDir>${basedir}/target/site/tlddoc</tldDocDir>
            </configuration>
          </plugin>
          <plugin>
            <!-- which goal is run here? -->
            <groupId>org.apache.myfaces.buildtools</groupId>
            <artifactId>myfaces-builder-plugin</artifactId>
            <version>${myfaces-builder-plugin-version}</version>
            <configuration>
              <taglibs>
                <t>http://myfaces.apache.org/tomahawk</t>
              </taglibs>
            </configuration>
          </plugin>
        </plugins>
      </reporting>
    </profile>

    <profile>
      <!--
        - Build and install into the repository some additional artifacts that we don't
        - want to build during normal development because they take too long.
        -->
      <id>generate-assembly</id>
      <activation>
        <property>
          <name>performRelease</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <!-- Install in the repository a "-javadoc.jar" file -->
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>2.8</version>
            <executions>
              <execution>
                <id>attach-javadoc</id>
                <goals><goal>jar</goal></goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <!-- Install in the repository a "-tlddoc.jar" file -->
            <groupId>net.sourceforge.maven-taglib</groupId>
            <artifactId>maven-taglib-plugin</artifactId>
            <version>2.4</version>
            <configuration>
              <!-- taglib.src.dir>${basedir}/target/classes/META-INF</taglib.src.dir -->
              <taglib.src.dir>${basedir}/target/tlddoc-facelets</taglib.src.dir>
              <tldDocDir>${basedir}/target/tlddoc</tldDocDir>
            </configuration>
            <executions>
              <execution>
                <id>attach-javadoc</id>
                <goals><goal>taglibdocjar</goal></goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <!-- Install in the repository a "-sources.jar" file -->
            <artifactId>maven-source-plugin</artifactId>
            <executions>
              <execution>
                <id>attach-source</id>
                <goals><goal>jar</goal></goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
