jvanzyl     2003/03/15 18:14:56

  Modified:    src/plugins-build/plexus plugin.jelly
  Log:
  o The entire Plexus plugin is now a dynamic tag library which will make
    the customization of a runtime very flexible. There will be sensible
    defaults but you will soon be able to control the layout in any
    fashion desired. This cleanup in preparation for granular control
    over classworlds inside the plexus container.
  
  Revision  Changes    Path
  1.14      +284 -227  jakarta-turbine-maven/src/plugins-build/plexus/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/plexus/plugin.jelly,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- plugin.jelly      12 Mar 2003 17:57:01 -0000      1.13
  +++ plugin.jelly      16 Mar 2003 02:14:55 -0000      1.14
  @@ -3,15 +3,63 @@
     xmlns:maven="jelly:maven"
     xmlns:util="jelly:util"
     xmlns:define="jelly:define"
  -  xmlns:reactor="reactor"
     xmlns:deploy="deploy"
     xmlns:sea="sea"
     xmlns:velocity="jelly:org.apache.commons.jelly.tags.velocity.VelocityTagLibrary"
  -  xmlns:plexus="jelly:org.apache.maven.plexus.jelly.PlexusTagLibrary">
  +  xmlns:plexus-taglib="jelly:org.apache.maven.plexus.jelly.PlexusTagLibrary"
  +  xmlns:plexus="plexus">
  +
  +  <!-- ===================================================================== -->
  +  <!-- D E P L O Y  P L E X U S                                              -->
  +  <!-- ===================================================================== -->
  +  <!-- Deploys Plexus into a self-contained directory that allows you        -->
  +  <!-- to run Plexus easily.                                                 -->
  +  <!-- ===================================================================== -->
  +
  +  <goal name="plexus:deploy" description="Deploys Plexus into a self-contained 
directory">
  +    
  +    <plexus:create-directory-structure
  +      base="${maven.plexus.runtimeDirectory}"
  +      bin="${maven.plexus.bin}"
  +      conf="${maven.plexus.conf}"
  +      comonents="${maven.plexus.components}"
  +      lib="${maven.plexus.lib}"
  +      appLib="${maven.plexus.appLib}"
  +      work="${maven.plexus.work}"/>
  +
  +    <plexus:assemble-plexus-dependencies
  +      plexusPomFile="${maven.plexus.pom}"
  +      plexusCoreLibDirectory="${maven.plexus.lib}"/>
  +
  +    <plexus:create-classworlds-configuration
  +      plexusPom="${maven.plexus.pom}"
  +      templatePath="${maven.plexus.templatePath}"
  +      
classWorldsConfiguration="${maven.plexus.conf}/${maven.plexus.launcherConfiguration}"
  +      
classWorldsConfigurationTemplate="${maven.plexus.launcherConfigurationTemplate}"/>
  +
  +    <plexus:create-launcher-scripts
  +      templatePath="${maven.plexus.templatePath}"
  +      unixScript="${maven.plexus.bin}/plexus.sh"
  +      windowsScript="${maven.plexus.bin}/plexus.bat"/>
  +
  +    <plexus:find-components
  +      plexusConfiguration="${confDir}/${conf}"/>
  +
  +    <plexus:create-component-partition
  +      pomFile="${modelPom}"
  +      directory="${maven.plexus.appLib}"/>
  +
  +    <plexus:process-configurations
  +      sourceDirectory="${confDir}"
  +      destinationDirectory="${maven.plexus.conf}"/>
  +
  +    <plexus:package-java-runtime/>
  +    
  +  </goal>
   
     <!--
      |
  -   | P L E X U S
  +   | Plexus Dynamic TagLibarary
      |
      | o Create a plexus project.
      | o Create a runtime based on a configuration.
  @@ -23,283 +71,292 @@
      | o Generate reports on the state of the overall project.
      |
      -->
  +  
  +  <define:taglib uri="plexus">
   
  -  <!-- ===================================================================== -->
  -  <!-- D E P L O Y  P L E X U S                                              -->
  -  <!-- ===================================================================== -->
  -  <!-- Deploys Plexus into a self-contained directory that allows you        -->
  -  <!-- to run Plexus easily.                                                 -->
  -  <!-- ===================================================================== -->
  -
  -  <goal name="plexus:deploy" description="Deploys Plexus into a self-contained 
directory">
  -    
  -    <!-- Create the directory structure for the deployed application -->
  +    <define:tag name="create-directory-structure">
  +      
  +      <delete dir="${base}"/>
       
  -    <delete dir="${maven.plexus.runtimeDirectory}"/>
  +      <mkdir dir="${bin}"/>
  +      <mkdir dir="${conf}"/>
  +      <mkdir dir="${components}"/>
  +      <mkdir dir="${lib}"/>
  +      <mkdir dir="${appLib}"/>
  +      <mkdir dir="${work}"/>
       
  -    <mkdir dir="${maven.plexus.bin}"/>
  -    <mkdir dir="${maven.plexus.conf}"/>
  -    <mkdir dir="${maven.plexus.components}"/>
  -    <mkdir dir="${maven.plexus.lib}"/>
  -    <mkdir dir="${maven.plexus.appLib}"/>
  -    <mkdir dir="${maven.plexus.work}"/>
  -            
  -    <mkdir dir="${maven.plexus.components}"/>
  +    </define:tag>
   
       <!--
        |
  -     | Create a project object from the Plexus POM so that we can glean
  -     | the required information about Plexus.
  +     | Copy any Plexus/Application configuration files.
        |
        -->
  +    <define:tag name="process-configurations">
       
  -    <maven:pom 
  -      projectDescriptor="${maven.plexus.pom}"
  -      var="plexusPom"/>
  -
  -    <j:set 
  -      var="plexusJar"
  -      
value="${maven.repo.local}/plexus/jars/${plexusPom.artifactId}-${plexusPom.currentVersion}.jar"/>
  -
  -    <util:available file="${plexusJar}">
  -      <j:set var="plexusJarPresent" value="true"/>
  -      <copy file="${plexusJar}" todir="${maven.plexus.lib}"/>
  -    </util:available>
  +      <util:properties file="${sourceDirectory}/app.properties" 
var="appProperties"/>
  +
  +      <copy 
  +        todir="${destinationDirectory}"
  +        overwrite="true"
  +        filtering="on">
  +        <fileset dir="${sourceDirectory}">
  +          <!-- Any *.app.properties files are the filtering files. -->
  +          <exclude name="*app.properties"/>
  +        </fileset>
  +        <filterset>
  +          <j:forEach var="appProperty" items="${appProperties.keys()}">
  +            <util:replace var="token" oldChar="." newChar="_" 
value="${appProperty}"/>
  +            <j:set var="token" value="${token.toUpperCase()}"/>
  +            <j:set var="propertyName" value="${appProperty}" />
  +            <j:set var="propertyValue" 
value="${appProperties.getProperty(propertyName)}"/>
  +            <filter token="${token}" value="${propertyValue}"/>
  +          </j:forEach>
  +        </filterset>
  +      </copy>
  +    
  +    </define:tag>
  +
  +    <define:tag name="assemble-plexus-dependencies">
  +      
  +      <maven:pom 
  +        projectDescriptor="${plexusPomFile}"
  +        var="plexusPom"/>
  +
  +      <j:set 
  +        var="plexusJar"
  +        
value="${maven.repo.local}/plexus/jars/${plexusPom.artifactId}-${plexusPom.currentVersion}.jar"/>
  +
  +      <util:available file="${plexusJar}">
  +        <j:set var="plexusJarPresent" value="true"/>
  +        <copy file="${plexusJar}" todir="${plexusCoreLibDirectory}"/>
  +      </util:available>
     
  -    <j:if test="${plexusJarPresent != 'true'}">
  -      <get 
  -        
src="http://www.ibiblio.org/maven/plexus/jars/${plexusPom.artifactId}-${plexusPom.currentVersion}.jar";
  -        dest="${maven.plexus.lib}"/>
  -    </j:if>
  +      <j:if test="${plexusJarPresent != 'true'}">
  +        <get 
  +          
src="http://www.ibiblio.org/maven/plexus/jars/${plexusPom.artifactId}-${plexusPom.currentVersion}.jar";
  +          dest="${plexusCoreLibDirectory}"/>
  +      </j:if>
   
  -    <!--
  -     |
  -     | Now we need to pull down Plexus' dependencies to satisfy runtime
  -     |  requirements.
  -     |
  -     -->
  +      <!--
  +       |
  +       | Now we need to pull down Plexus' dependencies to satisfy runtime
  +       |  requirements.
  +       |
  +       -->
       
  -    <echo>Retrieving any missing Plexus dependencies ... </echo>
  +      <echo>Retrieving any missing Plexus dependencies ... </echo>
       
  -    ${plexusPom.verifyDependencies()}
  +      ${plexusPom.verifyDependencies()}
       
  -    <!-- Copy the plexus dependencies into the runtime lib/. -->
  +      <!-- Copy the plexus dependencies into the runtime lib/. -->
       
  -    <deploy:copy-deps 
  -      projectDescriptor="${maven.plexus.pom}"
  -      todir="${maven.plexus.lib}"
  -      excludes="junit"/>
  -    
  -    <!-- Create the classworlds configuration. -->
  -    <attainGoal name="classworlds-configuration"/>
  -    
  -    <!-- Create the startup shell script. -->
  -    <attainGoal name="startup-shell-script"/>
  -    
  -    <attainGoal name="plexus:find-components"/>
  -    
  -    <!-- Read in the ui properties. -->
  -    <util:properties file="${confDir}/app.properties" var="appProperties"/>
  -
  -    <copy 
  -      todir="${maven.plexus.conf}"
  -      overwrite="true"
  -      filtering="on">
  -      <fileset dir="${confDir}"/>
  -      <filterset>
  -        <j:forEach var="appProperty" items="${appProperties.keys()}">
  -          <util:replace var="token" oldChar="." newChar="_" value="${appProperty}"/>
  -          <j:set var="token" value="${token.toUpperCase()}"/>
  -          <j:set var="propertyName" value="${appProperty}" />
  -          <j:set var="propertyValue" 
value="${appProperties.getProperty(propertyName)}"/>
  -          <filter token="${token}" value="${propertyValue}"/>
  -        </j:forEach>
  -      </filterset>
  -    </copy>
  -    
  -    <delete>
  -      <fileset dir="${maven.plexus.appLib}">
  -        <include name="plexus-*.jar"/>
  -      </fileset>
  -    </delete>
  +      <deploy:copy-deps 
  +        projectDescriptor="${plexusPomFile}"
  +        todir="${plexusCoreLibDirectory}"
  +        excludes="junit"/>
  +    
  +    </define:tag>
   
       <!--
        |
  -     | Include the JRE if specified. This is useful for applications
  -     | that need to be completely self-contained.
  -     |
  +     | @plexusPom
  +     | @templatePath
  +     | @classWorldsConfiguration
  +     | @classWorldsConfigurationTemplate
  +     | 
        -->
  -     
  -    <j:if test="${jre == 'true'}">
  -      <exec 
  -        executable="cp">
  -        <arg value="-r"/>
  -        <arg value="${java.home}"/>
  -        <arg value="${maven.plexus.jre}"/>
  -      </exec>
  -    </j:if>
  -      
  -  </goal>
  +    <define:tag name="create-classworlds-configuration">
   
  -  <!-- ===================================================================== -->
  -  <!-- F I N D  C O M P O N E N T S                                          -->
  -  <!-- ===================================================================== -->
  -  <!--                                                                       -->
  -  <!-- ===================================================================== -->
  +      <echo>
  +        @plexusPom = ${plexusPom}
  +        @templatePath = ${templatePath}
  +        @classWorldsConfiguration = ${classWorldsConfiguration}
  +        @classWorldsConfigurationTemplate = ${classWorldsConfigurationTemplate}
  +      </echo>
  +
  +      <maven:pom 
  +        projectDescriptor="${plexusPom}"
  +        var="project"/>
  +    
  +      <velocity:merge
  +        name="${classWorldsConfiguration}"
  +        basedir="${templatePath}"
  +        template="${classWorldsConfigurationTemplate}"/>
  +    
  +    </define:tag>
   
  -  <goal name="plexus:find-components">
  -    <plexus:find-implementations var="implementations" 
configuration="${confDir}/${conf}"/>
  +    <!--
  +     |
  +     | @templatePath
  +     | @unixScript
  +     | @windowsScript
  +     | 
  +     -->
  +    <define:tag name="create-launcher-scripts">
   
  -    <get 
  -      src="http://www.ibiblio.org/maven/plexus/plexus-component.manifest";
  -      dest="${plugin.dir}/plexus-component.manifest"/>
  -
  -    <util:properties 
  -      uri="file:${plugin.dir}/plexus-component.manifest" 
  -      var="components"/>
  -    
  -    <j:set var="pomDir" value="tmpPoms"/>
  -    <mkdir dir="${pomDir}"/>
  -     
  -    <j:forEach var="implementation" items="${implementations}">
  -    
  -      <echo> implementation = '${implementation}' </echo>
  -      
  -      <j:set var="component" value="${components.getProperty(implementation)}"/>
  -      <j:if test="${component.length() > 0}">
  -      
  -        <echo> component = '${component}' </echo>
  +      <echo>
  +        @templatePath = ${templatePath}
  +        @unixScript = ${unixScript}
  +        @windowsScript = ${windowsScript}
  +      </echo>
  +
  +      <velocity:merge
  +        name="${unixScript}"
  +        basedir="${templatePath}"
  +        template="plexus.vm"/>
  +
  +      <velocity:merge
  +        name="${windowsScript}"
  +        basedir="${templatePath}"
  +        template="plexus-bat.vm"/>
   
  -        <j:set 
  -          var="pom" 
  -          value="${maven.repo.local}/plexus/poms/${component}.pom"/>
  -      
  -        <j:set var="pomPresent" value="false"/>
  -        <util:available file="${pom}">
  -          <j:set var="pomPresent" value="true"/>
  -          <copy file="${pom}" todir="${pomDir}"/>
  -        </util:available>
  -      
  -        <j:if test="${pomPresent != 'true'}">
  -          <get 
  -            src="http://www.ibiblio.org/maven/plexus/poms/${component}.pom";
  -            dest="${pomDir}/${component}.pom"/>
  -        </j:if>
  -      </j:if>
  -    </j:forEach>
  +      <chmod file="${unixScript}" perm="+x"/>
  +    
  +    </define:tag>
   
       <!--
        |
  -     | Now we have the components. Let's get their dependencies.
  +     | @pomFile
  +     | @directory
  +     | @groupId We may want to supply the group id of the component as they
  +     |          may be standard Plexus components which inherit from another
  +     |          POM and currently we don't drag those down so the groupId will
  +     |          not be correct. So we will supply until we make this process
  +     |          more correct.
        |
        -->
  -       
  -    <fileScanner var="poms">
  -      <fileset dir="${pomDir}"/>
  -    </fileScanner>
  -
  -    <j:forEach var="depPomFile" items="${poms.iterator()}">
  -      <maven:pom projectDescriptor="${depPomFile}" var="depPom"/>
  +    
  +    <define:tag name="create-component-partition">
         
  -      <echo>Verifying dependencies for ${depPom.artifactId} ...</echo>
  +      <maven:pom projectDescriptor="${pomFile}" var="depPom"/>
         
  +      <echo>Verifying dependencies for ${depPom.artifactId} ...</echo>
  +
  +      <j:if test="${depPom.groupId == ''}">
  +        ${depPom.setGroupId(groupId)}
  +      </j:if>
  +
         <j:set 
           var="artifact" 
  -        
value="${maven.repo.local}/plexus/jars/${depPom.artifactId}-${depPom.currentVersion}.jar"/>
  -      
  +        
value="${maven.repo.local}/${depPom.groupId}/jars/${depPom.artifactId}-${depPom.currentVersion}.jar"/>
  +
         <util:available file="${artifact}">
           <j:set var="depPresent" value="true"/>
  -        <copy file="${artifact}" todir="${maven.plexus.components}"/>
  +        <!--
  +        <mkdir dir="${directory}/${depPom.artifactId}-${depPom.currentVersion}"/>
  +        <copy file="${artifact}" 
todir="${directory}/${depPom.artifactId}-${depPom.currentVersion}"/>
  +        -->
  +        <mkdir dir="${directory}"/>
  +        <copy file="${artifact}" todir="${directory}"/>
         </util:available>
         
         <j:if test="${depPresent != 'true'}">
           <get 
             
src="http://www.ibiblio.org/maven/plexus/jars/${depPom.artifactId}-${depPom.currentVersion}.jar";
  -          
dest="${maven.plexus.components}/${depPom.artifactId}-${depPom.currentVersion}.jar"/>
  +          dest="${directory}/${depPom.artifactId}-${depPom.currentVersion}.jar"/>
         </j:if>
   
         ${depPom.verifyDependencys()}
  -      
  +
  +        <!--
  +        todir="${directory}/${depPom.artifactId}-${depPom.currentVersion}"
  +        -->
  +
         <deploy:copy-deps 
  -        projectDescriptor="${depPomFile}"
  -        todir="${maven.plexus.appLib}"
  +        projectDescriptor="${pomFile}"
  +        todir="${directory}"
           excludes="junit"/>
  -        
  -    </j:forEach>
       
  -    <delete dir="${pomDir}"/>
  -    
  -  </goal>
  -  
  -
  -  <!-- ===================================================================== -->
  -  <!-- B U I L D  C O M P O N E N T S                                        -->
  -  <!-- ===================================================================== -->
  -
  -  <goal name="build-components" description="build components">
  -
  -    <maven:maven
  -      basedir="${basedir}/component-builds"
  -      descriptor="${basedir}/component-builds/project.xml"
  -      goals="build"
  -      ignoreFailures="false"
  -    />
  +    </define:tag>
   
  -  </goal>
  -
  -  <!-- ===================================================================== -->
  -  <!-- G E N E R A T E  L A U N C H E R  C O N F I G U R A T I O N           -->
  -  <!-- ===================================================================== -->
  +    <!--
  +     |
  +     | Include the JRE if specified. This is useful for applications
  +     | that need to be completely self-contained.
  +     |
  +     -->
  +    <define:tag name="package-java-runtime">
  +     
  +      <j:if test="${jre == 'true'}">
  +        <exec 
  +          executable="cp">
  +          <arg value="-r"/>
  +          <arg value="${java.home}"/>
  +          <arg value="${maven.plexus.jre}"/>
  +        </exec>
  +      </j:if>
  +    
  +    </define:tag>
  +    
  +    <define:tag name="find-components">
  +      
  +      <plexus-taglib:find-implementations 
  +        var="implementations" 
  +        configuration="${plexusConfiguration}"/>
   
  -  <goal 
  -    name="classworlds-configuration" 
  -    description="Generate launcher configuration">
  -    
  -    <maven:pom 
  -      projectDescriptor="${maven.plexus.pom}" 
  -      var="project"/>
  -    
  -    <velocity:merge
  -      name="${maven.plexus.conf}/${maven.plexus.launcherConfiguration}"
  -      basedir="${maven.plexus.templatePath}"
  -      template="${maven.plexus.launcherConfigurationTemplate}"/>
  +      <get 
  +        src="http://www.ibiblio.org/maven/plexus/plexus-component.manifest";
  +        dest="${plugin.dir}/plexus-component.manifest"/>
   
  -  </goal>
  +      <util:properties 
  +        uri="file:${plugin.dir}/plexus-component.manifest" 
  +        var="components"/>
  +    
  +      <j:set var="pomDir" value="tmpPoms"/>
  +      <mkdir dir="${pomDir}"/>
  +     
  +      <j:forEach var="implementation" items="${implementations}">
  +    
  +        <echo> implementation = '${implementation}' </echo>
  +      
  +        <j:set var="component" value="${components.getProperty(implementation)}"/>
  +        <j:if test="${component.length() > 0}">
  +      
  +          <echo> component = '${component}' </echo>
   
  -  <!-- ===================================================================== -->
  -  <!-- G E N E R A T E  S T A R T E R  S C R I P T                           -->
  -  <!-- ===================================================================== -->
  +          <j:set 
  +            var="pom" 
  +            value="${maven.repo.local}/plexus/poms/${component}.pom"/>
  +      
  +          <j:set var="pomPresent" value="false"/>
  +          <util:available file="${pom}">
  +            <j:set var="pomPresent" value="true"/>
  +            <copy file="${pom}" todir="${pomDir}"/>
  +          </util:available>
  +      
  +          <j:if test="${pomPresent != 'true'}">
  +            <get 
  +              src="http://www.ibiblio.org/maven/plexus/poms/${component}.pom";
  +              dest="${pomDir}/${component}.pom"/>
  +          </j:if>
  +        </j:if>
  +      </j:forEach>
   
  -  <goal 
  -    name="startup-shell-script" 
  -    description="Generate starter script">
  -
  -    <velocity:merge
  -      name="${maven.plexus.bin}/plexus.sh"
  -      basedir="${maven.plexus.templatePath}"
  -      template="plexus.vm"/>
  -
  -    <velocity:merge
  -      name="${maven.plexus.bin}/plexus.bat"
  -      basedir="${maven.plexus.templatePath}"
  -      template="plexus-bat.vm"/>
  +      <!--
  +       |
  +       | Now we have the components. Let's get their dependencies.
  +       |
  +       -->
  +       
  +      <fileScanner var="poms">
  +        <fileset dir="${pomDir}"/>
  +      </fileScanner>
   
  -    <chmod file="${maven.plexus.bin}/plexus.sh" perm="+x"/>
  +      <j:forEach var="depPomFile" items="${poms.iterator()}">
  +      
  +        <plexus:create-component-partition
  +          pomFile="${depPomFile}"
  +          groupId="plexus"
  +          directory="${maven.plexus.appLib}"/>
  +      
  +      </j:forEach>
       
  -  </goal>
  -
  -  <!-- ===================================================================== -->
  -  <!-- G E N E R A T E  S E A                                                -->
  -  <!-- ===================================================================== -->
  -
  -  <goal name="plexus:sea">
  +      <delete dir="${pomDir}"/>
       
  -    <attainGoal name="plexus:deploy"/>
  +    </define:tag>
       
  -    <sea:create
  -      sourceDirectory="${maven.plexus.runtimeDirectory}"
  -      seaName="plexus"
  -    />
  -  </goal>
  +  </define:taglib>
  +
   
   </project>
  
  
  

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

Reply via email to