Search in sources :

Example 1 with IssuesReportGenerator

use of org.apache.maven.plugins.issues.IssuesReportGenerator in project maven-plugins by apache.

the class TracMojo method executeReport.

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();
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) Issue(org.apache.maven.plugins.issues.Issue) IssuesReportGenerator(org.apache.maven.plugins.issues.IssuesReportGenerator) XmlRpcException(org.apache.xmlrpc.XmlRpcException) MalformedURLException(java.net.MalformedURLException) MavenReportException(org.apache.maven.reporting.MavenReportException) XmlRpcException(org.apache.xmlrpc.XmlRpcException) MavenReportException(org.apache.maven.reporting.MavenReportException)

Example 2 with IssuesReportGenerator

use of org.apache.maven.plugins.issues.IssuesReportGenerator in project maven-plugins by apache.

the class GitHubMojo method executeReport.

@Override
protected void executeReport(Locale locale) throws MavenReportException {
    // Validate parameters
    List<Integer> columnIds = IssuesReportHelper.getColumnIds(columnNames, githubColumns);
    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
        GitHubDownloader issueDownloader = new GitHubDownloader(project, githubAPIScheme, githubAPIPort, includeOpenIssues, onlyMilestoneIssues);
        issueDownloader.configureAuthentication(settingsDecrypter, githubAPIServerId, settings, getLog());
        List<Issue> issueList = issueDownloader.getIssueList();
        if (onlyCurrentVersion) {
            issueList = IssueUtils.getIssuesForVersion(issueList, project.getVersion());
            getLog().info("The GitHub Report will contain issues only for the current version.");
        }
        // Generate the report
        IssuesReportGenerator report = new IssuesReportGenerator(IssuesReportHelper.toIntArray(columnIds));
        if (issueList.isEmpty()) {
            report.doGenerateEmptyReport(getBundle(locale), getSink());
            getLog().warn("No issue was matched.");
        } else {
            report.doGenerateReport(getBundle(locale), getSink(), issueList);
        }
    } catch (MalformedURLException e) {
        // Rethrow this error so that the build fails
        throw new MavenReportException("The Github URL is incorrect.");
    } catch (Exception e) {
        throw new MavenReportException(e.getMessage(), e);
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) Issue(org.apache.maven.plugins.issues.Issue) IssuesReportGenerator(org.apache.maven.plugins.issues.IssuesReportGenerator) MalformedURLException(java.net.MalformedURLException) MavenReportException(org.apache.maven.reporting.MavenReportException) MavenReportException(org.apache.maven.reporting.MavenReportException)

Example 3 with IssuesReportGenerator

use of org.apache.maven.plugins.issues.IssuesReportGenerator in project maven-plugins by apache.

the class JiraMojo method executeReport.

public void executeReport(Locale locale) throws MavenReportException {
    // Validate parameters
    List<Integer> columnIds = IssuesReportHelper.getColumnIds(columnNames, JIRA_COLUMNS);
    if (columnIds.isEmpty()) {
        // 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
        AbstractJiraDownloader issueDownloader;
        if (mockDownloader != null) {
            issueDownloader = mockDownloader;
        } else {
            AdaptiveJiraDownloader downloader = new AdaptiveJiraDownloader();
            downloader.setForceClassic(forceRss);
            issueDownloader = downloader;
        }
        configureIssueDownloader(issueDownloader);
        issueDownloader.doExecute();
        List<Issue> issueList = issueDownloader.getIssueList();
        if (StringUtils.isNotEmpty(versionPrefix)) {
            int originalNumberOfIssues = issueList.size();
            issueList = IssueUtils.filterIssuesWithVersionPrefix(issueList, versionPrefix);
            getLog().debug("Filtered out " + issueList.size() + " issues of " + originalNumberOfIssues + " that matched the versionPrefix '" + versionPrefix + "'.");
        }
        if (onlyCurrentVersion) {
            String version = (versionPrefix == null ? "" : versionPrefix) + project.getVersion();
            issueList = IssueUtils.getIssuesForVersion(issueList, version);
            getLog().info("The JIRA Report will contain issues only for the current version.");
        }
        // Generate the report
        IssuesReportGenerator report = new IssuesReportGenerator(IssuesReportHelper.toIntArray(columnIds));
        if (issueList.isEmpty()) {
            report.doGenerateEmptyReport(getBundle(locale), getSink());
        } else {
            report.doGenerateReport(getBundle(locale), getSink(), issueList);
        }
    } catch (Exception e) {
        getLog().warn(e);
    }
}
Also used : Issue(org.apache.maven.plugins.issues.Issue) IssuesReportGenerator(org.apache.maven.plugins.issues.IssuesReportGenerator) MavenReportException(org.apache.maven.reporting.MavenReportException) MavenReportException(org.apache.maven.reporting.MavenReportException)

Aggregations

Issue (org.apache.maven.plugins.issues.Issue)3 IssuesReportGenerator (org.apache.maven.plugins.issues.IssuesReportGenerator)3 MavenReportException (org.apache.maven.reporting.MavenReportException)3 MalformedURLException (java.net.MalformedURLException)2 XmlRpcException (org.apache.xmlrpc.XmlRpcException)1