jon 01/08/09 01:31:17
Modified: src/services/java/org/apache/fulcrum/velocity
TurbineVelocityService.java
Log:
I just added the ability to specify an "absolute:" path to the templates
directory.
It works something like this:
services.VelocityService.file.resource.loader.path =
@ABSOLUTE_PATH@/templates,@ABSOLUTE_PATH@/templates/flux
You can then use Ant to do the filtering of the TR.props file:
<filter token="ABSOLUTE_PATH" value="absolute:${src.dir}"/>
<copy todir="${build.project.webinf}/conf" filtering="yes">
<fileset dir="${src.conf.dir}/" defaultexcludes="no">
<include name="*.properties"/>
<include name="*.xml"/>
</fileset>
</copy>
This has been tested and works wonderfully!
What this means is that your build system can define an absolute path and
you don't need to copy the templates into the webapp's directory anymore!
You can simply point at them in any directory for development purposes.
This makes it easier for designers because the templates directory doesn't
need to be nested way down in a complicated directory structure. It also
removes the need to have a "build" step in order to copy the modified
templates into another directory.
I'm open to suggestions for something other than "absolute:", but this
works for me for now.
woo hoo! I have been wanting to solve this problem for a long while now.
-jon
Revision Changes Path
1.3 +5 -1
jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/velocity/TurbineVelocityService.java
Index: TurbineVelocityService.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-fulcrum/src/services/java/org/apache/fulcrum/velocity/TurbineVelocityService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TurbineVelocityService.java 2001/08/08 23:34:07 1.2
+++ TurbineVelocityService.java 2001/08/09 08:31:17 1.3
@@ -91,7 +91,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sean Legassick</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
- * @version $Id: TurbineVelocityService.java,v 1.2 2001/08/08 23:34:07 dlr Exp $
+ * @version $Id: TurbineVelocityService.java,v 1.3 2001/08/09 08:31:17 jon Exp $
*/
public class TurbineVelocityService
extends BaseTemplateEngineService
@@ -380,6 +380,10 @@
path = path.substring(9);
}
path = "jar:file:" + getRealPath(path) + entry;
+ }
+ else if (path.startsWith("absolute:"))
+ {
+ path = path.substring ("absolute:".length(), path.length());
}
else if (!path.startsWith("jar:"))
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]