示例#1
0
  private void configureIssueDownloader(TracDownloader issueDownloader) {
    issueDownloader.setProject(project);

    issueDownloader.setQuery(query);

    issueDownloader.setTracPassword(tracPassword);

    issueDownloader.setTracUser(tracUser);
  }
示例#2
0
  public void executeReport(Locale locale) throws MavenReportException {
    // Validate parameters
    List<Integer> columnIds =
        IssuesReportHelper.getColumnIds(
            columnNames, TRAC_COLUMNS, DEPRECATED_TRAC_COLUMNS, getLog());
    if (columnIds.size() == 0) {
      // This can happen if the user has configured column names and they are all invalid
      throw new MavenReportException(
          "maven-changes-plugin: None of the configured columnNames '"
              + columnNames
              + "' are valid.");
    }

    try {
      // Download issues
      TracDownloader issueDownloader = new TracDownloader();
      configureIssueDownloader(issueDownloader);

      List<Issue> issueList = issueDownloader.getIssueList();

      // Generate the report
      IssuesReportGenerator report =
          new IssuesReportGenerator(IssuesReportHelper.toIntArray(columnIds));

      if (issueList.isEmpty()) {
        report.doGenerateEmptyReport(getBundle(locale), getSink());
        getLog().warn("No ticket has matched.");
      } else {
        report.doGenerateReport(getBundle(locale), getSink(), issueList);
      }
    } catch (MalformedURLException e) {
      // Rethrow this error so that the build fails
      throw new MavenReportException("The Trac URL is incorrect.");
    } catch (XmlRpcException e) {
      // Rethrow this error so that the build fails
      throw new MavenReportException("XmlRpc Error.", e);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }