[prev in list] [next in list] [prev in thread] [next in thread] 

List:       velocity-user
Subject:    Texen oddity - Singleton or not to Singleton
From:       "Ryan Gustafson" <ryan_gustafson () hotmail ! com>
Date:       2002-01-29 18:08:48
[Download RAW message or body]

Hello,

I'm using Texen to automate the generation of my templates pages .  Each 
template resides in it's own directory.  Each directory contains a .vm file 
we want to process.

Here's what my Texen tasks look like in my Ant build.xml file, try to ignore 
the fact I'm using Velocity to generate JSPs :)

     <texen
        controlTemplate="page.vm"
        outputDirectory="${src.docroot}/ClearanceSearchEdit"
        templatePath="${src.docroot}/ClearanceSearchEdit,${src.docroot}"
        outputFile="page.jsp"
     />
     <texen
        controlTemplate="page.vm"
        outputDirectory="${src.docroot}/MNCaseSearch"
        templatePath="${src.docroot}/MNCaseSearch,${src.docroot}"
        outputFile="page.jsp"
     />


Now for the behaviour.  The first task runs just fine.  The second task 
runs, but it generates the _same_ output as the first task, because Texen 
pulled up the "page.vm" file from the first task, and not the one it should 
be finding for the second task.  The templatePath was not being used 
properly.

I realized it likely had to do with texen using the same instance of the 
Velocity Engine, and having already found the "page.vm" resource from the 
previous invokation.  I eventually hacked the Texen source to always use a 
new VelocityEngine everytime it executes(), and the problem went away.

I feel Texen task invokations should be independent of each other, and there 
should not be these side-effect behaviours like this unless explicitly 
desired.  That way Texen behaves more like your standard stateless build 
targets (javac, copy, delete, etc).

Anyway, thought I'd point this out.  Perhaps someone with better knowledge 
of the internals of Texen and Velocity can properly address this at some 
point.

Thanks,
Ryan Gustafson


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic