jstrachan    2002/06/10 07:17:48

  Added:       src/bin  mediator.jelly
  Log:
  added an experimental mediator jelly script to show how we could initialize maven 
once then use jelly to mediate between the POM beans, properties and Ant tasks.
  here we use jexl to access the pom and use pom.getProperties() to get Ant style 
properties. 
  Note if we didn't use '.' as a separator between names in the properties life would 
be easier, we could
  use ${maven_compile_deprecation} for example.
  
  this example doesn't show how to do plugins in a better way, though that should be 
able to be done on the client side, invoking stuff before or after the body of a 
target.
  
  Revision  Changes    Path
  1.1                  jakarta-turbine-maven/src/bin/mediator.jelly
  
  Index: mediator.jelly
  ===================================================================
  <!--
    ||   An example mediator file
    -->
  <j:jelly
    trim="true"
    xmlns:ant="jelly:ant"
    xmlns:jelly="jelly:core"
    xmlns:util="maven:util"
    xmlns:maven="jelly:org.apache.maven.jelly.MavenTagLibrary">
    
    <!-- 
      || Initializes Maven, creates the variables etc
      || export the POM as a variable that we can use to populate 
      || maven-beans or Ant Tasks or Jelly tags
    -->
    <maven:init var="pom"/>
    
    <!--
      || now lets process all the arguments
    -->
    <j:forEach 
      var="target"
      items="${args}"
      begin="1">
      
        <!-- It'd be cleaner to have a <mavem:target> tag -->
            
      <j:choose>
          <j:when test="${target=='compile'}>
  
                <!-- check dependencies -->
                <maven:check type="compile"/>
                
                <!-- compile target -->
                <ant:javac 
              srcdir="${pom.build.sourceDirectory}"
                  destdir="${pom.properties['maven.build.dest]}"
                  excludes="**/package.html"
                  debug="${pom.properties['maven.compile.debug']}"
                  deprecation="${pom.properties['maven.compile.deprecation']}"
                  optimize="${pom.properties['maven.compile.optimize']}">
                  <classpath>
                <path refid="maven.dependency.classpath"/>
                <pathelement path="${pom.build.dest}"/>
                  </classpath>
        </ant:javac>
          </j:when>
                
          <j:otherwise>
            Unknown target ${target}
          </j:otherwise>
      </j:choose>
      
    </j:forEach>
    
  </j:jelly>
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to