You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Laurie Harper <la...@holoweb.net> on 2008/02/20 01:20:56 UTC

filtering of archetype resources

How do I package resources in an archetype so that they don't get 
filtered through Velocity when the archetype is used? Currently Velocity 
is choking on Javascript files contained in the archetype, and I'd 
rather not have to modify all the Javascript files so they will pass 
through Velocity without error (the archetype is packaging third-party 
code I don't want to modify).

Thanks,

L.

$ mvn --version
Maven version: 2.0.6
$ mvn archetype:create ...
...
[ERROR] Parser Exception: 
archetype-resources/src/main/webapp/lib/.../xxx.js : 
org.apache.velocity.runtime.parser.ParseException: Encountered " " at 
line 664, column 11.
Was expecting one of:
     <EOF>
     "(" ...
     <RPAREN> ...
     <ESCAPE_DIRECTIVE> ...
     <SET_DIRECTIVE> ...
     "\\\\" ...
     "\\" ...
     <TEXT> ...
     <SINGLE_LINE_COMMENT> ...
     "*#" ...
     "*#" ...
     <STRING_LITERAL> ...
     "if" ...
     "stop" ...
     <NUMBER_LITERAL> ...
     <WORD> ...
     <IDENTIFIER> ...
     <DOT> ...
     "{" ...
     "}" ...


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


Re: filtering of archetype resources

Posted by Laurie Harper <la...@holoweb.net>.
Stuart McCulloch wrote:
> On 23/02/2008, Laurie Harper <la...@holoweb.net> wrote:
>> Stuart McCulloch wrote:
>>> On 20/02/2008, Laurie Harper <la...@holoweb.net> wrote:
>>>> How do I package resources in an archetype so that they don't get
>>>> filtered through Velocity when the archetype is used? Currently
>> Velocity
>>>> is choking on Javascript files contained in the archetype, and I'd
>>>> rather not have to modify all the Javascript files so they will pass
>>>> through Velocity without error (the archetype is packaging third-party
>>>> code I don't want to modify).
>>>
>>> perhaps you could try adding:
>>>
>>>    #literal()
>>>
>>> to the start of the file, and:
>>>
>>>    #end
>>>
>>> to the end of the file - any text between should be copied literally by
>>> Velocity
>>
>> That doesn't really avoid modifying the files though... and it's not
>> clear to me that it'd help in all cases (e.g. binary file types, if
>> Maven/Velocity isn't already smart enough to skip them, or any file
>> where stray whitespace at the start is an issue, etc...)
>>
>> The 'obvious' solution I tried (w/out success) was to specify the
>> archetype resources in the same way I would in a POM in the same
>> situation:
>>
>>    <resources>
>>      <filtering>false</filtering>
>>      <includes>
>>        <resource>src/main/webapp/...</resource>
>>        ...
>>
>> but unfortunately that doesn't seem to work in archetype.xml. Any other
>> possibilities?
> 
> 
> have you tried setting the "filtered" attribute for the particular resource
> entry, ie:
> 
>   <resources>
>     <resource>src/main/resources/readme.txt</resource>
>     <resource filtered="false">src/main/resources/BINARY</resource>
>   </resources>
> 
> that's worked for me in the past when I want to exclude binary files from
> filtering

Just tried it, but it doesn't seem to have any effect :-( I guess I need 
to start digging through the archetype plugin code...

L.


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


Re: filtering of archetype resources

Posted by Stuart McCulloch <st...@jayway.net>.
On 23/02/2008, Laurie Harper <la...@holoweb.net> wrote:
>
> Stuart McCulloch wrote:
> > On 20/02/2008, Laurie Harper <la...@holoweb.net> wrote:
> >> How do I package resources in an archetype so that they don't get
> >> filtered through Velocity when the archetype is used? Currently
> Velocity
> >> is choking on Javascript files contained in the archetype, and I'd
> >> rather not have to modify all the Javascript files so they will pass
> >> through Velocity without error (the archetype is packaging third-party
> >> code I don't want to modify).
> >
> >
> > perhaps you could try adding:
> >
> >    #literal()
> >
> > to the start of the file, and:
> >
> >    #end
> >
> > to the end of the file - any text between should be copied literally by
> > Velocity
>
>
> That doesn't really avoid modifying the files though... and it's not
> clear to me that it'd help in all cases (e.g. binary file types, if
> Maven/Velocity isn't already smart enough to skip them, or any file
> where stray whitespace at the start is an issue, etc...)
>
> The 'obvious' solution I tried (w/out success) was to specify the
> archetype resources in the same way I would in a POM in the same
> situation:
>
>    <resources>
>      <filtering>false</filtering>
>      <includes>
>        <resource>src/main/webapp/...</resource>
>        ...
>
> but unfortunately that doesn't seem to work in archetype.xml. Any other
> possibilities?


have you tried setting the "filtered" attribute for the particular resource
entry, ie:

  <resources>
    <resource>src/main/resources/readme.txt</resource>
    <resource filtered="false">src/main/resources/BINARY</resource>
  </resources>

that's worked for me in the past when I want to exclude binary files from
filtering

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

Re: filtering of archetype resources

Posted by Laurie Harper <la...@holoweb.net>.
Stuart McCulloch wrote:
> On 20/02/2008, Laurie Harper <la...@holoweb.net> wrote:
>> How do I package resources in an archetype so that they don't get
>> filtered through Velocity when the archetype is used? Currently Velocity
>> is choking on Javascript files contained in the archetype, and I'd
>> rather not have to modify all the Javascript files so they will pass
>> through Velocity without error (the archetype is packaging third-party
>> code I don't want to modify).
> 
> 
> perhaps you could try adding:
> 
>    #literal()
> 
> to the start of the file, and:
> 
>    #end
> 
> to the end of the file - any text between should be copied literally by
> Velocity

That doesn't really avoid modifying the files though... and it's not 
clear to me that it'd help in all cases (e.g. binary file types, if 
Maven/Velocity isn't already smart enough to skip them, or any file 
where stray whitespace at the start is an issue, etc...)

The 'obvious' solution I tried (w/out success) was to specify the 
archetype resources in the same way I would in a POM in the same situation:

   <resources>
     <filtering>false</filtering>
     <includes>
       <resource>src/main/webapp/...</resource>
       ...

but unfortunately that doesn't seem to work in archetype.xml. Any other 
possibilities?

L.


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


Re: filtering of archetype resources

Posted by Stuart McCulloch <st...@jayway.net>.
On 20/02/2008, Laurie Harper <la...@holoweb.net> wrote:
>
> How do I package resources in an archetype so that they don't get
> filtered through Velocity when the archetype is used? Currently Velocity
> is choking on Javascript files contained in the archetype, and I'd
> rather not have to modify all the Javascript files so they will pass
> through Velocity without error (the archetype is packaging third-party
> code I don't want to modify).


perhaps you could try adding:

   #literal()

to the start of the file, and:

   #end

to the end of the file - any text between should be copied literally by
Velocity

HTH

Thanks,
>
> L.
>
> $ mvn --version
> Maven version: 2.0.6
> $ mvn archetype:create ...
> ...
> [ERROR] Parser Exception:
> archetype-resources/src/main/webapp/lib/.../xxx.js :
> org.apache.velocity.runtime.parser.ParseException: Encountered " " at
> line 664, column 11.
> Was expecting one of:
>      <EOF>
>      "(" ...
>      <RPAREN> ...
>      <ESCAPE_DIRECTIVE> ...
>      <SET_DIRECTIVE> ...
>      "\\\\" ...
>      "\\" ...
>      <TEXT> ...
>      <SINGLE_LINE_COMMENT> ...
>      "*#" ...
>      "*#" ...
>      <STRING_LITERAL> ...
>      "if" ...
>      "stop" ...
>      <NUMBER_LITERAL> ...
>      <WORD> ...
>      <IDENTIFIER> ...
>      <DOT> ...
>      "{" ...
>      "}" ...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Cheers, Stuart