Dashboard > CruiseControl > TheCruiseControlJavaServerPage > JSPExpectsLogDirectoryNameEqualsProjectName
JSPExpectsLogDirectoryNameEqualsProjectName Log In | Sign Up   View a printable version of the current page.

Added by Christopher Pickslay , last edited by Christopher Pickslay on Oct 31, 2006  (view change)
Labels: 
(None)

In CruiseControl 2.5, the main index.jsp page in the binary distribution (cruisecontrol-bin-2.5/webapps/cruisecontrol/index.jsp) only works correctly if your log directory has the same name as your project. If  that's not the case, then the build buttons won't work, because the jmx control doesn't recognize the log directory as a project name. Here's a change that makes it work correctly.

In the jsp, there's an inner class called Info that's used to encapsulate and sort the parsed build results.  The Info class has a project variable that holds the name of the log directory. I added a projectName variable that holds the actual project name, as parsed from the last successful build.  Here's the diff:

43a44,45
> <%@ page import="java.util.regex.Pattern" %>
> <%@ page import="java.util.regex.Matcher" %>
174a177,194
>         BufferedReader reader = new BufferedReader(new FileReader(latestSuccessfulLogFile.getFile()));
>         Pattern pattern = Pattern.compile("property name=\"projectname\" value=\"(.+)\"");
>         String line = null;
>         try {
>             while ((line = reader.readLine()) != null) {
>                 Matcher matcher = pattern.matcher(line);
>                 if (matcher.find()) {
>                     this.projectName = matcher.group(1);
>                     break;
>                 }
>             }
>         } catch (IOException e) {
>             e.printStackTrace();
>         } finally {
>             if (reader != null) {
>                 reader.close();
>             }
>         }
503c523
<               <td class="data"><a href="buildresults/<%=info[i].project%>"><%=info[i].project%></a></td>
---
>               <td class="data"><a href="buildresults/<%=info[i].project%>"><%=info[i].projectName%></a></td>
510,511c530,531
<               <td class="data"><input id="<%= "force_" + info[i].project %>" type="button"
<                                       onclick="callServer('<%= jmxURLPrefix + info[i].project %>', '<%=info[i].project%>')"
---
>               <td class="data"><input id="<%= "force_" + info[i].projectName %>" type="button"
>                                       onclick="callServer('<%= jmxURLPrefix + info[i].projectName %>', '<%=info[i].projectName%>')"
Powered by a free Atlassian Confluence Open Source Project License granted to ThoughtWorks, Inc.. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators