Hi,

I have that. Here is my code:

props.setProperty(VelocityEngine.RESOURCE_LOADER, "classpath");
props.setProperty("classpath." + VelocityEngine.RESOURCE_LOADER +
".class",ClasspathResourceLoader.class.getName());
engine.init(props);

Then I load my template with this:

Template template =
Velocity.getTemplate("src/main/resources/templates/description.vm");

But this location is not in my .war file. Is there maybe something like the
Path Annotation for Assets to get a reliable path?

Moritz



Angelo Chen wrote:
> 
> Hi,
> 
> here is what I did:
> 
> store it under resources, then add:
>   p.setProperty("resource.loader", "class");
>  p.setProperty("class.resource.loader.class",
> "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
>  engine.init(p);
> 
> 
> MoritzGilsdorf wrote:
>> 
>> Hi,
>> 
>> I'm trying to find a good place to store auxiliary files inside my
>> project. I'm using velocity templates to generate simple text-files and
>> in my development folder they are stored in
>> CLASSPATH/src/main/resources/templates/.
>> 
>> When I deploy my Project, the template directory is stored in my Projects
>> .jar directly under templates and the app can't find them there.
>> 
>> How can I store my templates so that find the with one command both in my
>> dev-dir and in my deployed-dir? 
>> 
>> Thanks,
>> 
>> Moritz 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-Using-resources-tp15618690p15629016.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to