You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Hensley, Richard" <Ri...@McKesson.com> on 2001/11/02 02:21:24 UTC

Using Anakia with a velocity.properties file and templatePath att ribute

I'm goofing around with the Anakia example because I'm going to use
Anakia to generate some static html. One of the things that I noticed
was a number of warnings in the velocity.log:

Thu Nov 01 16:58:19 PST 2001   [warn] Velocimacro : VM addition rejected
: makeProject : inline not allowed to replace existing VM

I remembered reading something on the list about having the resource
loader cache turned on to prevent these warnings, so I built a
velocity.properties file in the build directory. When the file was
present, the real problem I'm having surfaced. The documentation says
that the templatePath attribute of the Anakia task overrides the path
defined in the velocity.properties. My velocity.properites contained
only the following:

file.resource.loader.cache = true 

However when I ran ant, I got the following error: 

   [anakia] Error:
org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource './site.vsl' 

This sounded like a path problem so I started investigating the Anakia
code and I found the following snippet in the Anakia.execute method:

            if ( velocityPropertiesFile.exists() ) 
            { 
                ve.init(velocityPropertiesFile.getAbsolutePath()); 
            } 
            else if (templatePath != null && templatePath.length() > 0) 
            { 
                ve.setProperty(
RuntimeConstants.FILE_RESOURCE_LOADER_PATH, 
                    templatePath); 
                ve.init(); 
            } 

If I'm reading this code correctly, it says if there is a velocity
properties file, use it. Otherwise, set the file resource loader path to
the template path.

I found this in velocity-1.2-rc2. I check the most recent
AnakiaTask.java in cvs, and it has the same code snippet. 

I'm not sure which, but either the documentation is wrong, or the code
is wrong. 

What should the fixed? 

I'm still a very new user, so I'm not sure how to fix the code. However,
I could fix the Anakia.xml documentation file. 

Richard Hensley 
Sr. Technical Development Advisor 
Fellow, McKesson Information Solutions, 2000 
McKesson Information Solutions - Horizon Lab 
(541) 681-8221 
mailto:richard.hensley@itb.mckhboc.com
<ma...@itb.mckhboc.com>  

Confidentiality Notice: This e-mail message, including any attachments,
is for the sole use of the intended recipients and may contain
confidential and privileged information.  Any unauthorized review, use,
disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply e-mail and destroy all
copies of the original message.