Grails Groovy错误。怎么了?

Grails Groovy错误。怎么了?,grails,groovy,Grails,Groovy,怎么了 Exception: javax.script.ScriptException: groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported): startup failed: SimpleTemplateScript3

怎么了

Exception: javax.script.ScriptException:
   groovy.lang.GroovyRuntimeException: Failed to parse template script (your template may contain an error or be trying to use expressions not currently supported):
   startup failed: SimpleTemplateScript34.groovy: 66: unexpected token: } @ line 66, column 7.
      """); } ;
            ^ 1 error 
这是模板

<STYLE>
BODY, TABLE, TD, TH, P {
 font-family:Verdana,Helvetica,sans serif;
font-size:11px;
color:black;
}
h1 { color:black; }
h2 { color:black; }
h3 { color:black; }
TD.bg1 { color:white; background-color:#0000C0; font-size:120% }
TD.bg2 { color:white; background-color:#4040FF; font-size:110% }
TD.bg3 { color:white; background-color:#8080FF; }
TD.test_passed { color:blue; }
TD.test_failed { color:red; }
TD.console { font-family:Courier New; }

.news{text-align:center;padding-top:15px;}
.bottom-message{width:720px;cellpadding:5px;cellspacing:0px}
.bottom-message .message{font-size:13px;color:#aaa;line-height:18px;text-align:center}
.bottom-message .designed{font-size:13px;color:#aaa;line-height:18px;font-style:     italic;text-align:right}

</STYLE>
<BODY>
<div class="news">
    <P>
        Do you like new format of build information? <a href="mailto:xxxx@xxxxx.com">Give me feedback</a>
    </P>
    <br>
</div>
<TABLE>
  <TR><TD align="right"><IMG SRC="${rooturl}static/e59dfe28/images/32x32/<%= build.result.toString() == 'SUCCESS' ? "blue.gif" : build.result.toString() == 'FAILURE' ? 'red.gif' : 'yellow.gif' %>" />
  </TD><TD valign="center"><B style="font-size: 200%;">BUILD ${build.result}</B></TD>    </TR>
  <TR><TD>Build URL</TD><TD><A href="${rooturl}${build.url}">${rooturl}${build.url}    </A></TD></TR>
  <TR><TD>Project:</TD><TD>${project.name}</TD></TR>
  <TR><TD>Date of build:</TD><TD>${it.timestampString}</TD></TR>
  <TR><TD>Build duration:</TD><TD>${build.durationString}</TD></TR>
</TABLE>
<BR/>

    <!-- CHANGE SET -->
    <% def changeSet = build.changeSet
    if(changeSet != null) {
def hadChanges = false %>
    <TABLE width="100%">
    <TR><TD class="bg1" colspan="2"><B>CHANGES</B></TD></TR>
    <%  changeSet.each() { cs ->
        hadChanges = true %>        
      <TR>
            <TD colspan="2" class="bg2">${spc}Revision <B><%=         cs.metaClass.hasProperty('commitId') ? cs.commitId :     cs.metaClass.hasProperty('revision')     ? cs.revision : 
        cs.metaClass.hasProperty('changeNumber') ? cs.changeNumber : "" %></B> by
              <B><%= cs.author %>: </B>
              <B>(${cs.msgAnnotated})</B>
             </TD>
          </TR>

<%  } %>

    if(!hadChanges) { %>    
    <TR><TD colspan="2">No Changes</TD></TR>

  </TABLE>
<BR/>
<% } %>

<!-- ARTIFACTS -->
<% def artifacts = build.artifacts
if(artifacts != null && artifacts.size() > 0) { %>
  <TABLE width="100%">
<TR><TD class="bg1"><B>BUILD ATRIFACTS</B></TD></TR>
<TR>
  <TD>
<%      artifacts.each() { f -> %>      
          <li>
            <a href="${rooturl}${build.url}artifact/${f}">${f}</a>
          </li>
<%      } %>
      </TD>
        </TR>
  </TABLE>
    <BR/>  
    <% } %>    

        <!-- MAVEN ARTIFACTS -->
        <% 
        try {
      def mbuilds = build.moduleBuilds
      if(mbuilds != null) { %>
      <TABLE width="100%">
      <TR><TD class="bg1"><B>BUILD ATRIFACTS</B></TD></TR>
    <%    mbuild.each() { m -> %>     
            <TR><TD class="bg2"><B>${m.key.displayName}</B></TD></TR>
    <%      m.value.each() { mvnbld ->
            def artifactz = mvnbld.artifacts
            if(artifactz != null && artifactz.size() > 0) {     %>          
      <TR>
        <TD>
<%              artifactz.each() { f -> %>          
            <li>
              <a href="${rooturl}${mvnbld.url}artifact/${f}">${f}</a>
            </li>
<%              } %>        
        </TD>
      </TR>
<%          } 
        }
     } %>      
  </TABLE>
<BR/>
<% } 
} catch(e) {
    // we don't do anything
} %>

<!-- CONSOLE OUTPUT -->
<% if(build.result==hudson.model.Result.FAILURE) { %>
<TABLE width="100%" cellpadding="0" cellspacing="0">
<TR><TD class="bg1"><B>CONSOLE OUTPUT</B></TD></TR>
<%  build.getLog(100).each() { line -> %>
    <TR><TD class="console">${line}</TD></TR>
<%  } %>
</TABLE>
<BR/>
<% } %>


  <table class="bottom-message" align="center">
        <tr>
            <td>

            </td>        
            <td class="message">You are receiving this email because you
                are relavent with this build<br>
            <P>
                <a href="#">support team</a> | <a href="#">Jenkins server</a>
            </P>
        </td>
    </tr>
    <tr>
        <td colspan="2" class="designed">designed by XXXX&nbsp;</td>
    </tr>
</table>
<!-- bottom message -->


</BODY>

这里不想讽刺,但很明显在第66行第7列有一个意外的标记-}。我肯定你只是有一个不平衡的卷发


更重要的问题是,您真的想使用Stackoverflow这样调试代码吗?

Urgh。。。你有跨越close标记的if语句,很难看到你想做什么。。。也许可以制作一个小模板,从那里工作,而不是这个有多个问题删除一些部分,看看它是否工作:-。这是相当模拟的,但你会得到错误。此外,正如@tim_yates所说,如果将ifs与markupI混合在一起,那么太多ifs就是地狱。我建议您在Grails标记中查找诸如g:if、g:else、g:each之类的语句,它们将帮助您组织模板。另外请看,这是定义css资源的好方法,可以将样式和标记与代码分离。