-2

怎么了?

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>
4

1 回答 1

0

在这里不是要讽刺,但很明显,在第 66 行第 7 列有一个意想不到的标记 - } -。我敢肯定你只是有一个不平衡的花括号。

更重要的问题,你真的想用 Stackoverflow 来调试你的代码吗?

于 2012-11-23T13:00:49.457 回答