How can I get around a nested expressions in Maven Plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I get around a nested expressions in Maven Plugin

rahul-12
Hi,

I am writing a plugin that can patch resourses for different J2EE
servers. My build.properties file looks as below:

<snip>
# Resources to be patched (comma-separated list)
# this sets up identifiers for resources
# FIXME : Trim leading and trailing spaces in list
maven.assembler.patch.list=jrun,tomcat,weblogic

# set up patch-sets here (src, target & includes)
maven.assembler.patch.jrun.src=${basedir}/patches/jrun
maven.assembler.patch.jrun.target=${basedir}/www
maven.assembler.patch.jrun.includes=**.*.properties

maven.assembler.patch.tomcat.src=${basedir}/patches/tomcat
maven.assembler.patch.tomcat.target=${basedir}/www
maven.assembler.patch.tomcat.includes=**/*.xml

maven.assembler.patch.weblogic.src=${basedir}/patches/weblogic
maven.assembler.patch.weblogic.target=${basedir}/www
maven.assembler.patch.weblogic.includes=**/*.xml,**.*.properties
</snip>

and, I need to process it dynamically like this :
(a) create a list of patches. (easy)
(b) Iterate over patches and build 'patch-sets'. (stuck here!)
(c) copy over patches. (easy )

The plugin goal is reproduced below:
<goal name="erm:assemble">
    <j:set var="list" value="${maven.assembler.patch.list}" />
   
    <j:if test="${!empty(list)}">
      <util:tokenize var="patches" delim=","
trim="true">${list}</util:tokenize>
     
      <j:forEach items="${patches}" var="patchID" indexVar="index">      
        <log:info>INFO: Building Patch set for Patch ID :
${patchID}</log:info>
       
        <j:set var="patch.src.dir"
value="maven.assembler.patch.${patchID}.src" />
                         ^^^^^^^^^^^          
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (This is where I need nested expression,
something like ${maven.assembler.patch.${patchID}.src}   )

        <j:set var="patch.target.dir"
value="maven.assembler.patch.${patchID}.target" />                  
                         ^^^^^^^^^^^              
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     
        <!-- TODO: Test for valid source and target folders -->
        <!-- Set up a temporary folder where release is being packaged -->
        <j:set var="release.packaging.dir"
value="${basedir}/release-packaging" />
        <ant:delete dir="${release.packaging.dir}"/>
        <ant:mkdir dir="${release.packaging.dir}"/>
       
        <!-- Make a copy of source folders in the release-packaging
directory -->
        <ant:copy todir="${release.packaging.dir}/${patch.target.dir}" >
          <fileset dir="${patch.src.dir}" includes="**/*.*" />
          <!-- Use includes to filter file types -->
        </ant:copy>        
       
        <!-- Copy over patches to target dir created under release
packaging -->
        <ant:copy todir="${release.packaging.dir}/${patch.target.dir}" >
          <fileset dir="${patch.target.dir}" includes="**/*.*" />
          <!-- Use includes to filter file types -->
        </ant:copy>      

      </j:forEach>
    </j:if>    
  </goal>

Thanks in advance for any pointers. Appreciate it.

Cheers,

Rahul


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How can I get around a nested expressions in Maven Plugin

Brett Porter
Please try and keep your examples short so it is easier to find what you need.

Where you showed this:
${maven.assembler.patch.${patchID}.src}

I think what you want is:
${context.getVariable('maven.assembler.patch.'+pathID+'.src')}

HTH,
Brett

On 6/3/05, Rahul <[hidden email]> wrote:

> Hi,
>
> I am writing a plugin that can patch resourses for different J2EE
> servers. My build.properties file looks as below:
>
> <snip>
> # Resources to be patched (comma-separated list)
> # this sets up identifiers for resources
> # FIXME : Trim leading and trailing spaces in list
> maven.assembler.patch.list=jrun,tomcat,weblogic
>
> # set up patch-sets here (src, target & includes)
> maven.assembler.patch.jrun.src=${basedir}/patches/jrun
> maven.assembler.patch.jrun.target=${basedir}/www
> maven.assembler.patch.jrun.includes=**.*.properties
>
> maven.assembler.patch.tomcat.src=${basedir}/patches/tomcat
> maven.assembler.patch.tomcat.target=${basedir}/www
> maven.assembler.patch.tomcat.includes=**/*.xml
>
> maven.assembler.patch.weblogic.src=${basedir}/patches/weblogic
> maven.assembler.patch.weblogic.target=${basedir}/www
> maven.assembler.patch.weblogic.includes=**/*.xml,**.*.properties
> </snip>
>
> and, I need to process it dynamically like this :
> (a) create a list of patches. (easy)
> (b) Iterate over patches and build 'patch-sets'. (stuck here!)
> (c) copy over patches. (easy )
>
> The plugin goal is reproduced below:
> <goal name="erm:assemble">
>     <j:set var="list" value="${maven.assembler.patch.list}" />
>
>     <j:if test="${!empty(list)}">
>       <util:tokenize var="patches" delim=","
> trim="true">${list}</util:tokenize>
>
>       <j:forEach items="${patches}" var="patchID" indexVar="index">
>         <log:info>INFO: Building Patch set for Patch ID :
> ${patchID}</log:info>
>
>         <j:set var="patch.src.dir"
> value="maven.assembler.patch.${patchID}.src" />
>                          ^^^^^^^^^^^
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (This is where I need nested expression,
> something like ${maven.assembler.patch.${patchID}.src}   )
>
>         <j:set var="patch.target.dir"
> value="maven.assembler.patch.${patchID}.target" />
>                          ^^^^^^^^^^^
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>         <!-- TODO: Test for valid source and target folders -->
>         <!-- Set up a temporary folder where release is being packaged -->
>         <j:set var="release.packaging.dir"
> value="${basedir}/release-packaging" />
>         <ant:delete dir="${release.packaging.dir}"/>
>         <ant:mkdir dir="${release.packaging.dir}"/>
>
>         <!-- Make a copy of source folders in the release-packaging
> directory -->
>         <ant:copy todir="${release.packaging.dir}/${patch.target.dir}" >
>           <fileset dir="${patch.src.dir}" includes="**/*.*" />
>           <!-- Use includes to filter file types -->
>         </ant:copy>
>
>         <!-- Copy over patches to target dir created under release
> packaging -->
>         <ant:copy todir="${release.packaging.dir}/${patch.target.dir}" >
>           <fileset dir="${patch.target.dir}" includes="**/*.*" />
>           <!-- Use includes to filter file types -->
>         </ant:copy>
>
>       </j:forEach>
>     </j:if>
>   </goal>
>
> Thanks in advance for any pointers. Appreciate it.
>
> Cheers,
>
> Rahul
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: How can I get around a nested expressions in Maven Plugin

rahul-12
Thanks Brett,

Will keep that in mind :-)

Cheers,
Rahul

Brett Porter wrote:

>Please try and keep your examples short so it is easier to find what you need.
>
>Where you showed this:
>${maven.assembler.patch.${patchID}.src}
>
>I think what you want is:
>${context.getVariable('maven.assembler.patch.'+pathID+'.src')}
>
>HTH,
>Brett
>
>On 6/3/05, Rahul <[hidden email]> wrote:
>  
>
>>Hi,
>>
>>I am writing a plugin that can patch resourses for different J2EE
>>servers. My build.properties file looks as below:
>>
>><snip>
>># Resources to be patched (comma-separated list)
>># this sets up identifiers for resources
>># FIXME : Trim leading and trailing spaces in list
>>maven.assembler.patch.list=jrun,tomcat,weblogic
>>
>># set up patch-sets here (src, target & includes)
>>maven.assembler.patch.jrun.src=${basedir}/patches/jrun
>>maven.assembler.patch.jrun.target=${basedir}/www
>>maven.assembler.patch.jrun.includes=**.*.properties
>>
>>maven.assembler.patch.tomcat.src=${basedir}/patches/tomcat
>>maven.assembler.patch.tomcat.target=${basedir}/www
>>maven.assembler.patch.tomcat.includes=**/*.xml
>>
>>maven.assembler.patch.weblogic.src=${basedir}/patches/weblogic
>>maven.assembler.patch.weblogic.target=${basedir}/www
>>maven.assembler.patch.weblogic.includes=**/*.xml,**.*.properties
>></snip>
>>
>>and, I need to process it dynamically like this :
>>(a) create a list of patches. (easy)
>>(b) Iterate over patches and build 'patch-sets'. (stuck here!)
>>(c) copy over patches. (easy )
>>
>>The plugin goal is reproduced below:
>><goal name="erm:assemble">
>>    <j:set var="list" value="${maven.assembler.patch.list}" />
>>
>>    <j:if test="${!empty(list)}">
>>      <util:tokenize var="patches" delim=","
>>trim="true">${list}</util:tokenize>
>>
>>      <j:forEach items="${patches}" var="patchID" indexVar="index">
>>        <log:info>INFO: Building Patch set for Patch ID :
>>${patchID}</log:info>
>>
>>        <j:set var="patch.src.dir"
>>value="maven.assembler.patch.${patchID}.src" />
>>                         ^^^^^^^^^^^
>>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ (This is where I need nested expression,
>>something like ${maven.assembler.patch.${patchID}.src}   )
>>
>>        <j:set var="patch.target.dir"
>>value="maven.assembler.patch.${patchID}.target" />
>>                         ^^^^^^^^^^^
>>^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>>        <!-- TODO: Test for valid source and target folders -->
>>        <!-- Set up a temporary folder where release is being packaged -->
>>        <j:set var="release.packaging.dir"
>>value="${basedir}/release-packaging" />
>>        <ant:delete dir="${release.packaging.dir}"/>
>>        <ant:mkdir dir="${release.packaging.dir}"/>
>>
>>        <!-- Make a copy of source folders in the release-packaging
>>directory -->
>>        <ant:copy todir="${release.packaging.dir}/${patch.target.dir}" >
>>          <fileset dir="${patch.src.dir}" includes="**/*.*" />
>>          <!-- Use includes to filter file types -->
>>        </ant:copy>
>>
>>        <!-- Copy over patches to target dir created under release
>>packaging -->
>>        <ant:copy todir="${release.packaging.dir}/${patch.target.dir}" >
>>          <fileset dir="${patch.target.dir}" includes="**/*.*" />
>>          <!-- Use includes to filter file types -->
>>        </ant:copy>
>>
>>      </j:forEach>
>>    </j:if>
>>  </goal>
>>
>>Thanks in advance for any pointers. Appreciate it.
>>
>>Cheers,
>>
>>Rahul
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [hidden email]
>>For additional commands, e-mail: [hidden email]
>>
>>
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [hidden email]
>For additional commands, e-mail: [hidden email]
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]