You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Dennis Lundberg <de...@apache.org> on 2007/11/11 00:02:49 UTC

Re: Problems using Velocity with Maven

I've gone through the docs for the site-plugin today. It turns out that 
all skinning is lost when you use a custom Velocity template file. The 
recommendation is to create a skin instead.

andzy wrote:
> Thanks for the quick response.
> I had tried this, but unfortunately it doesn't help.
> Maven is able to find and use my .vm file (as I can change static HTML
> text), but apparently cannot pass data from it's site.xml file, as the .vm
> file doesn't seem to have access to elements of that XML file (to create
> dynamic HTML text).
> 
> 
> 
> dennisl-2 wrote:
>> Hi
>>
>> According to the docs here:
>>  
>> http://maven.apache.org/plugins/maven-site-plugin/examples/templatefile.html
>>
>> You should also add this to your configuration
>>    <templateDirectory>${basedir}</templateDirectory>
>>
>> The default value for templateDirectory is src/site.
>>
>> Or you could move your maven-site.vm file to the src/site directory.
>>
>> andzy wrote:
>>> Hi!
>>> I'm trying to learn how to use Velocity and Maven to generate some HTML
>>> pages. (I'm using Velocity Engine that comes with Maven 2.0.5)
>>> The problem I have is that my .vm file does not "see" structure of the
>>> Maven's site declaration.
>>>
>>> When I run Maven without reference to my .vm file, it generates HTML file
>>> with the structure of the site as defined in /src/site/site.xml file (as
>>> well as the contents of the index.apt file).
>>> This works fine.
>>>
>>> Then I add my custom Velocity file "maven-site.vm" and reference it in
>>> the
>>> pom.xml file:
>>>     <plugin>
>>>         <groupId>org.apache.maven.plugins</groupId>
>>>         <artifactId>maven-site-plugin</artifactId>
>>>         <version>2.0-beta-5</version>
>>>         <configuration>
>>>             <templateFile>maven-site.vm</templateFile>
>>>             <inputEncoding>UTF-8</inputEncoding>
>>>             <outputEncoding>UTF-8</outputEncoding>
>>>         </configuration>
>>>     </plugin>
>>> I can change the generated HTML page with the help of my Velocity file.
>>> However, when I try to retrieve the "site.xml" structure using
>>> $siteDescriptor.getChild() (for example, $siteDescriptor.getChild(
>>> "bannerLeft" ) ), I always get null.
>>> Why is it so?
>>>
>>> Is there anything else I have to define?
>>>
>>> Or is my file structure incorrect?
>>> Here is the structure of my sample project:
>>>     --WebTest
>>>       |-- pom.xml
>>>       |-- build.xml
>>>       |-- maven-site.vm
>>>       +-- src
>>>           |--+ site
>>>               |-- site.xml
>>>               |--+ apt
>>>                  |- index.apt
>>>
>>> I've spent a lot of time searching for solution, but haven't been able to
>>> find the answer.
>>> Thanks!
>>>
>>
>> -- 
>> Dennis Lundberg
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
> 


-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org