On 08/01/2008, Thor <[EMAIL PROTECTED]> wrote:
>
> Hello everyone. Thanks for reading.
> I'm having some issues while executing an Archetype that I've created
> (using
> the Guide to Creating Archetypes).
> This archetype creates a webapp that already has several components: JSPs,
> XML files, CSS, JS, and so on, that I need as templates for developing web
> applications.
> The problem is that when I execute the mvn archetype:create... Velocity
> throws a ParseException because of the expressions on the JSP and XML
> files,
> such as ${user.unreadMessages>0} or ${var:maxlength}. In the first case is
> an EL expression and in the second is the declaration of a var for the
> Validation Framewework.
> I don't know very much of Apache Velocity, but when it process my files is
> when it throws the exception, 'cause those are not valid VTL expressions.
>
> ¿Does anybody knows how to avoid this problem?
You could mark large sections of your files with:
#literal()
this ${text} will ${appear} as ${verbatim}
#end
to stop Velocity from interpolating the text at all.
alternatively you could use the following trick:
#set( $dollar = "$" )
an ${dollar}{example} variable
as afaik Velocity will only interpolate the text once.
HTH
Thanks a lot for your help..
>
> Here's a piece of the stacktrace:
>
> [ERROR] Parser Exception:
> archetype-resources/src/main/webapp/WEB-INF/conf/validator/validation.xml
> :
> org.apache.velocit
> y.runtime.parser.ParseException: Encountered ":maxlength}\"
> resource=\"false\" />\r\n <var>\r\n
>
> <var-name>maxlength</var-name>\r\n
> <var-value>" at line 23,
> column 58.
> Was expecting one of:
> "}" ...
> <DOT> ...
>
> at
> org.apache.velocity.runtime.parser.Parser.generateParseException(
> Parser.java:3271)
> at org.apache.velocity.runtime.parser.Parser.jj_consume_token(
> Parser.java:3155)
> at org.apache.velocity.runtime.parser.Parser.Reference(Parser.java
> :1157)
> at org.apache.velocity.runtime.parser.Parser.Statement(Parser.java
> :301)
> at org.apache.velocity.runtime.parser.Parser.process(Parser.java
> :258)
> at org.apache.velocity.runtime.parser.Parser.parse(Parser.java
> :104)
> at org.apache.velocity.runtime.RuntimeInstance.parse(
> RuntimeInstance.java:776)
> at org.apache.velocity.runtime.RuntimeInstance.parse(
> RuntimeInstance.java:720)
> at org.apache.velocity.Template.process(Template.java:123)
> at
> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(
> ResourceManagerImpl.java:423)
> at
> org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(
> ResourceManagerImpl.java:341)
> at org.apache.velocity.runtime.RuntimeInstance.getTemplate(
> RuntimeInstance.java:831)
> at org.apache.velocity.app.VelocityEngine.mergeTemplate(
> VelocityEngine.java:440)
> at org.apache.maven.archetype.DefaultArchetype.processTemplate(
> DefaultArchetype.java:870)
> at org.apache.maven.archetype.DefaultArchetype.processTemplate(
> DefaultArchetype.java:730)
> at org.apache.maven.archetype.DefaultArchetype.processResources(
> DefaultArchetype.java:777)
> at org.apache.maven.archetype.DefaultArchetype.processTemplates(
> DefaultArchetype.java:687)
> at org.apache.maven.archetype.DefaultArchetype.createArchetype(
> DefaultArchetype.java:329)
> at org.apache.maven.plugin.archetype.MavenArchetypeMojo.execute(
> MavenArchetypeMojo.java:188)
> at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
> DefaultPluginManager.java:447)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
> DefaultLifecycleExecutor.java:539)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(
> DefaultLifecycleExecutor.java:493)
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
> (
> DefaultLifecycleExecutor.java:463)
> at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
> (DefaultLifecycleExecutor.jav
> a:311)
>
--
Cheers, Stuart