You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Erik Hatcher <er...@gmail.com> on 2015/01/09 14:59:40 UTC

velocimacro.library - all specified required?

I’m trying to set up a system that has some built-in (to a JAR, class path loader) macros defined (in _macros.vm) and allows the user, in their own file system loader path, to define macros.vm (without underscore prefix) to add their own.

I’m trying this:
   engine.setProperty(RuntimeConstants.VM_LIBRARY, "_macros.vm,macros.vm”);

But I get errors if macros.vm is not found.

Can I make it so that velocimacro.library loaded files are optional, such that if macros.vm isn’t there all works fine?   It’s giving me an error currently. 

Also, when given that comma-separated list, are they loaded in that order such that a macro defined in macros.vm can override one in _macros.vm?

Thanks for your help!

	Erik




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


Re: velocimacro.library - all specified required?

Posted by Nathan Bubna <nb...@gmail.com>.
Glad you figured it out. I must have been thinking of the default macros
file lookup, which used to "warn" with a big error message. I suppose it
makes sense that a specified, but missing file be treated as an error.
Though that's certainly a debatable behavior.

On Wed, Jan 14, 2015 at 1:28 PM, Erik Hatcher <er...@gmail.com>
wrote:

> Thanks Nathan for the reply.
>
> I worked around this issue by setting up a special loader that had all the
> (all empty but one) velocimacro’s defined, allowing one or more of them to
> be overridden by earlier loaders.
>
> But yeah, it chokes if the velocimacro’s specified don’t exist, not just a
> warning alas.
>
>         Erik
>
> > On Jan 14, 2015, at 3:10 PM, Nathan Bubna <nb...@gmail.com> wrote:
> >
> > On Fri, Jan 9, 2015 at 6:59 AM, Erik Hatcher <er...@gmail.com>
> wrote:
> >
> >> I’m trying to set up a system that has some built-in (to a JAR, class
> path
> >> loader) macros defined (in _macros.vm) and allows the user, in their own
> >> file system loader path, to define macros.vm (without underscore
> prefix) to
> >> add their own.
> >>
> >> I’m trying this:
> >>   engine.setProperty(RuntimeConstants.VM_LIBRARY,
> "_macros.vm,macros.vm”);
> >>
> >> But I get errors if macros.vm is not found.
> >>
> >
> > Those errors should effectively just be warnings and not interrupt the
> > process. (Disclaimer: i haven't dealt with that stuff in a while)
> >
> > Can I make it so that velocimacro.library loaded files are optional, such
> >> that if macros.vm isn’t there all works fine?   It’s giving me an error
> >> currently.
> >>
> >
> > No, sorry, no way to mark a file as optional.
> >
> >
> >> Also, when given that comma-separated list, are they loaded in that
> order
> >> such that a macro defined in macros.vm can override one in _macros.vm?
> >>
> >
> > Later definitions should override newer ones by default, i think. But
> > again, it's been a while since i worked with macros in this way.
> >
> >
> >> Thanks for your help!
> >>
> >>        Erik
> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
>
>

Re: velocimacro.library - all specified required?

Posted by Erik Hatcher <er...@gmail.com>.
Thanks Nathan for the reply.

I worked around this issue by setting up a special loader that had all the (all empty but one) velocimacro’s defined, allowing one or more of them to be overridden by earlier loaders.

But yeah, it chokes if the velocimacro’s specified don’t exist, not just a warning alas.

	Erik

> On Jan 14, 2015, at 3:10 PM, Nathan Bubna <nb...@gmail.com> wrote:
> 
> On Fri, Jan 9, 2015 at 6:59 AM, Erik Hatcher <er...@gmail.com> wrote:
> 
>> I’m trying to set up a system that has some built-in (to a JAR, class path
>> loader) macros defined (in _macros.vm) and allows the user, in their own
>> file system loader path, to define macros.vm (without underscore prefix) to
>> add their own.
>> 
>> I’m trying this:
>>   engine.setProperty(RuntimeConstants.VM_LIBRARY, "_macros.vm,macros.vm”);
>> 
>> But I get errors if macros.vm is not found.
>> 
> 
> Those errors should effectively just be warnings and not interrupt the
> process. (Disclaimer: i haven't dealt with that stuff in a while)
> 
> Can I make it so that velocimacro.library loaded files are optional, such
>> that if macros.vm isn’t there all works fine?   It’s giving me an error
>> currently.
>> 
> 
> No, sorry, no way to mark a file as optional.
> 
> 
>> Also, when given that comma-separated list, are they loaded in that order
>> such that a macro defined in macros.vm can override one in _macros.vm?
>> 
> 
> Later definitions should override newer ones by default, i think. But
> again, it's been a while since i worked with macros in this way.
> 
> 
>> Thanks for your help!
>> 
>>        Erik
>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> 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


Re: velocimacro.library - all specified required?

Posted by Nathan Bubna <nb...@gmail.com>.
On Fri, Jan 9, 2015 at 6:59 AM, Erik Hatcher <er...@gmail.com> wrote:

> I’m trying to set up a system that has some built-in (to a JAR, class path
> loader) macros defined (in _macros.vm) and allows the user, in their own
> file system loader path, to define macros.vm (without underscore prefix) to
> add their own.
>
> I’m trying this:
>    engine.setProperty(RuntimeConstants.VM_LIBRARY, "_macros.vm,macros.vm”);
>
> But I get errors if macros.vm is not found.
>

Those errors should effectively just be warnings and not interrupt the
process. (Disclaimer: i haven't dealt with that stuff in a while)

Can I make it so that velocimacro.library loaded files are optional, such
> that if macros.vm isn’t there all works fine?   It’s giving me an error
> currently.
>

No, sorry, no way to mark a file as optional.


> Also, when given that comma-separated list, are they loaded in that order
> such that a macro defined in macros.vm can override one in _macros.vm?
>

Later definitions should override newer ones by default, i think. But
again, it's been a while since i worked with macros in this way.


> Thanks for your help!
>
>         Erik
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>