velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hensley, Richard" <Richard.Hens...@McKesson.com>
Subject Problem with Anakia in Velocity 1.2-rc2
Date Tue, 06 Nov 2001 18:49:05 GMT
I'm using Anakia to build some static web pages. During this process, 
I had a need to create and configure a velocity.properties file My first
cut at the velocity.properties had: 

file.resource.loader.cache = true 

My anakia build task looks like: 

        <anakia basedir="${docs.src}" destdir="${docs.dest}/" 
             extension=".html" style="./site.vsl" 
             projectFile="./stylesheets/project.xml" 
             excludes="**/stylesheets/**" 
             includes="**/*.xml" 
             lastModifiedCheck="true" 
             templatePath="../xdocs/stylesheets" 
        > 

and the velocity.properties file is in the same directory as the
build.xml 
file. 

When I had the velocity.properties file in the build directory, I get
the 
following errors in velocity.log 
   [anakia] Error: 
org.apache.velocity.exception.ResourceNotFoundException: Unable to find 
resource './site.vsl' 

This error did not occur when the velocity.properties file was not
present. 

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. 

The Anakia documentation states that when a velocity.properties files is

present, and a templatePath attribute is set, the templatePath attribute

overrides appropriate settings in the velocity.properties file. 

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. 

This is very easy to recreate with the Anakia examples. Just put a
velocity.properties file in the build directory. Make sure that the
velocity.properties file does not contain a file resource loader path.

Richard Hensley 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message