<?xml version="1.0"?>

<project 
  xmlns:j="jelly:core"
  xmlns:d="jelly:define"
  xmlns:pom="pom"
  xmlns:util="jelly:util"
  xmlns:artifact="artifact"
  >

  <!-- set up pom tag library -->
  <d:taglib uri="pom">
    
    <d:jellybean
      name="contentvalidator"
      className="org.apache.maven.ContentValidator"
      method="execute"
    />

  </d:taglib>

  <!-- default goal -->
  <goal name="pom" description="Validate the Maven XML project descriptor"
    prereqs="pom:validate" />

  <!-- ================================================================== -->
  <!-- V A L I D A T E  P O M                                             -->
  <!-- ================================================================== -->

  <goal
    name="pom:validate"
    description="Validate the Maven XML project descriptor">

    <taskdef name="validate" classname="org.iso_relax.ant.JARVTask">
      <classpath path="${plugin.getDependencyPath('isorelax')}"/>
      <classpath path="${plugin.getDependencyPath('xercesjarv')}"/>
      <classpath path="${plugin.getDependencyPath('xerces')}"/>
    </taskdef>

    <validate
      schemaLanguage="http://www.w3.org/2001/XMLSchema"
      schema="${maven.home}/maven-project.xsd"
      file="${pom.file.canonicalPath}" />

  </goal>
  
  <goal
    name="pom:contentvalidate"
    description="Validate the content of the Maven POM">
    <j:new className="org.apache.maven.ContentValidator" var="contentvalidator"/>
    <j:setProperties object="${contentvalidator}" project="${pom}"/>
    
    <j:set var="notices" value="${contentvalidator.execute()}"/>
     
    <j:forEach var="notice" items="${notices}">
      <echo>${notice.Level} : ${notice.Section} : ${notice.Message}</echo>
    </j:forEach>

  </goal>

  <!-- ================================================================== -->
  <!-- U P D A T E  P O M                                                 -->
  <!-- ================================================================== -->

  <goal
    name="pom:update"
    description="Update the POM from its current version to a specified version">

  </goal>

  <!-- ========================================================================== -->
  <!-- I N S T A L L  P O M                                                       -->
  <!-- ========================================================================== -->

  <goal name="pom:install"
        description="Install POM in the local repository.">

      <artifact:install
         artifact="project.xml"
         type="pom"
         project="${pom}"/> 
  </goal>

  <!-- ========================================================================== -->
  <!-- D E P L O Y  P O M                                                         -->
  <!-- ========================================================================== -->
  <!-- POMs are deployed in the form ${pom.artifactId}-${pom.currentVersion}.pom  -->
  <!-- to match the same versioning convention as JARs. Having the POMs           -->
  <!-- deployed during each release will allow someone to build any               -->
  <!-- version of a project reliably.                                             -->
  <!-- ========================================================================== -->

  <goal name="pom:deploy"
        description="Deploy POM to the central repository.">
        
    <artifact:deploy
        artifact="project.xml"
        type="pom"
        project="${pom}"/>     
  </goal>
  
  
  
  
    
  <!--==================================================================-->
  <!-- Install the snapshot version of the war in the local repository  -->
  <!--==================================================================-->      
  <goal name="pom:install-snapshot"
        description="Install the snapshot version of the POM in the local repository">
        
      <artifact:install-snapshot
        artifact="project.xml"
        type="pom"
        project="${pom}"/> 
        
  </goal>


        
  <!--==================================================================-->
  <!-- Deploys the snapshot of the war to the remote repository         -->
  <!--==================================================================-->      
  <goal name="pom:deploy-snapshot" 
        description="Deploys the snapshot version of the POM to remote repository">  

     <artifact:deploy-snapshot
        artifact="project.xml"
        type="pom"
        project="${pom}"/>    
        
  </goal>
  
  
  
  

</project>
