MyEclipse Forums
This thread has been locked & this forum has been archived.
Please post new topics to Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
View previous topic Printable version Log in to check your private messages View next topic
Author Message
Post subject: Velocity not allowing inline macros  PostPosted: Apr 30, 2012 - 12:18 PM

Joined: Apr 25, 2012
Posts: 17

Hello all,

after unsuccessfully searching through forum posts, reading webistes, etc.
I am back to my unsolved problem:

I am trying to use velocity templates to generate custom DAOs and POJOs.
On using the velocity templates, I added my own macro into a file named Common.vm
I then wanted to include this Common.vm within the main Pojo template Pojo.vm using the directive $template.Common. As this file also holds macros, that are used within the DAO processing, I wanted this file Common.vm to be on a common folder level:
<workspace>/MyProject/src/velocityTemplates/Common.vm instead of /MyProject/src/velocityTemplates/pojo/Common.vm
Once I start the reverse engineering, I always get the following warning:
2012-04-30 13:07:11,803 WARN Worker-28 org.hibernate.tool.hbm2x.template - Velocimacro : VM addition rejected : toUnderscore : inline not allowed to replace existing VM

I found the following 2 posts:

One of them suggests, that you will need to change the file.
The other one says, that hibernate encapsulated this file, so that users should not tamper it directly. Where can I tell velocity within myEclipse, that I want to use my own macros?

I looked at your tutorial on But sadly, this whole subchapter named "5.5 Using templates to fine tune generated code' seems to be a bit short on that respect. I could not find any more information on this topic. Only the apache velocity webiste might help in that respect.
Any more detailed update on this chapter would be great.
I found out, that this would normally require a file named to be edited. I did not find any such file, so I guess, this has to be created. Does myEclipse look for such a file, so I can use inline macros? Is my approach for putting in my own macros correct? Does the GUI currently provide means to customize such velocity-relevant settings?

Maybe have a small example within this chapter, explaining on how to setup your toolchain, so it allows for changing properties.

As a suggestion: I was missing some flash player on firefox in order to view your training vidoes embedded within the text. After opening it in Opera, I saw those. Mabe it would be a good idear, to show an image with some helpful information in case someone is missing this specific plugin? Before using opera, I just had huge blank spaces, where the video should be.
 View user's profile Send private message  
Reply with quote Back to top
Post subject:   PostPosted: May 01, 2012 - 01:56 PM

Joined: Nov 11, 2010
Posts: 2491


Sorry that you are seeing this issue. I could replicate the issue at my end.

You can directly include the macro in one of the existing vm files and call it instead of using the #template.

I am afraid there is no way to customize the file and I suggest you use the workaround instead.

Hope this helps.

MyEclipse Support
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group