我在JIRA中有以下Velocity模板(注意,保留额外的行):
NOTE: Please REPLY-TO this email when replying to this issue.
##parse("templates/email/includes/issueplugins.vm")
#if($comment.getId())[ ${baseurl}/browse/${issue.getKey()} ] #end ##?page=${tabpanel-comment}&focusedCommentId=${comment.getId()}#action_${comment.getId()} ] #end
#if($remoteUser.fullName)
$i18n.getText("template.issue.commented.on", $remoteUser.fullName, $issue.getKey())
#dashes($!remoteUser.fullName)--------------#dashes($issue.getKey())-
#end
#if($changelog)
#changes([])
#end
#comment()
#visibility()
#parse("templates/email/text/includes/issuesummary.vm")
#parse("templates/email/text/includes/footer.vm")
最后一行后面没有行。我什么时候在最后一行:
##parse("templates/email/text/includes/footer.vm")
我收到以下错误:
An error occurred whilst rendering this message. Please contact the administrators, and inform them of this bug.
Details:
-------
org.apache.velocity.exception.ParseErrorException: Lexical error:
org.apache.velocity.runtime.parser.TokenMgrError:
Lexical error at line 20, column 51. Encountered: <EOF> after : ""
at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:272)
at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:202)
...
我从2004年发现了以下问题:
https://issues.apache.org/jira/browse/VELOCITY-272
这似乎暗示这是1.5中修复的错误。检查我的JIRA系统信息,我看到JIRA 4.2.1似乎建议使用版本1.6:
Atlassian Template Renderer Velocity 1.6插件 - 1.1.1
当我将从#if($comment.getId())
开始的行移动到结尾时,错误消失了。我在模板末尾做错了什么,或者这是一个错误?
修改
嗯。当我这样做时:
#if($comment.getId())[ ${baseurl}/browse/${issue.getKey()} ] #end ##?page=${tabpanel-comment}&focusedCommentId=${comment.getId()}#action_${comment.getId()} ] #end
作为最后一行,后面没有空行,我得到了同样的错误。但是,如果我在该行之后添加一行(只需点击ENTER
一次),它就会起作用。
Velocity模板需要一个结束空间吗?我很困惑。
答案 0 :(得分:1)
~/tech/atlassian/atlassian-jira-4.4.1-standalone $ find . -name "*velocity*.jar"
./atlassian-jira/WEB-INF/lib/velocity-1.4-atlassian-9.jar
./atlassian-jira/WEB-INF/lib/velocity-tools-1.3.jar
./atlassian-jira/WEB-INF/lib/atlassian-velocity-0.8.jar
不,他们没有;见this discussion from a few days ago ..