On Fri, 2005-09-30 at 10:03 +0800, Allan Ramirez wrote:
> Hi everyone,
> 
> I have this plugin  that can read a velocity template, but the template 
> must be in the classpath of the plugin to read it.
> Now, I am trying to modify the plugin which it can able to read 
> templates from other projects. Any ideas?

You can specify a parameter for the template as an URL and use the
URLResourceLoader buried in Velocity if you're looking for a general way
to locate a template.

So you can use:

http://svn.apache.org/viewcvs.cgi/jakarta/velocity/core/trunk/whiteboard/geir/URLResourceLoader.java?rev=191743&view=markup

Just make it part of the mojo.

You can also use the ContextClassLoaderResourceLoader which is part of
the plexus-velocity-component itself which is what the archetype
mechanism users. If you want to put your templates in a JAR, then create
your own classloader, add the JAR url and set the context classloader.
Or there's actually a JAR resource loader in velocity.

Or you can make your own resource loader :-)

-- 
jvz.

Jason van Zyl
jason at maven.org
http://maven.apache.org

We know what we are, but know not what we may be.

  -- Shakespeare


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

Reply via email to