You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by andzy <an...@hotmail.com> on 2007/08/19 15:29:37 UTC

Problems using Velocity with Maven

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!

-- 
View this message in context: http://www.nabble.com/Problems-using-Velocity-with-Maven-tf4293420.html#a12222150
Sent from the Velocity - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Problems using Velocity with Maven

Posted by Nathan Bubna <nb...@gmail.com>.
I would recommend asking the Maven users@maven.apache.org list.  They
are responsible for all Maven/Velocity integration.   I know of only
one guy around here who might know, and he is fairly busy these days
and may not have time to follow this list carefully or answer
questions.

On 8/19/07, andzy <an...@hotmail.com> 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!
>
> --
> View this message in context: http://www.nabble.com/Problems-using-Velocity-with-Maven-tf4293420.html#a12222150
> Sent from the Velocity - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org