public void execute()

in src/main/java/org/apache/maven/plugins/announcement/AnnouncementMojo.java [483:594]


    public void execute()
        throws MojoExecutionException
    {
        // Fail build fast if it is using deprecated parameters
        failIfUsingDeprecatedParameter( outputDirectory, "outputDirectory", "announcementDirectory" );
        failIfUsingDeprecatedParameter( generateJiraAnnouncement, "generateJiraAnnouncement",
                                        "issueManagementSystems " );
        failIfUsingDeprecatedParameter( jiraMerge, "jiraMerge", "issueManagementSystems " );

        // Run only at the execution root
        if ( runOnlyAtExecutionRoot && !isThisTheExecutionRoot() )
        {
            getLog().info( "Skipping the announcement generation in this project because it's not the Execution Root" );
        }
        else
        {
            if ( issueManagementSystems == null )
            {
                issueManagementSystems = new ArrayList<>();
            }

            if ( issueManagementSystems.isEmpty() )
            {
                issueManagementSystems.add( CHANGES_XML );
            }

            // Fetch releases from the configured issue management systems
            List<Release> releases = null;
            if ( issueManagementSystems.contains( CHANGES_XML ) )
            {
                if ( getXmlPath().exists() )
                {
                    ChangesXML changesXML = new ChangesXML( getXmlPath(), getLog() );
                    List<Release> changesReleases = changesXML.getReleaseList();
                    releases = releaseUtils.mergeReleases( null, changesReleases );
                    getLog().info( "Including issues from file " + getXmlPath() + " in announcement..." );
                }
                else
                {
                    getLog().warn( "changes.xml file " + getXmlPath().getAbsolutePath() + " does not exist." );
                }
            }

            if ( issueManagementSystems.contains( JIRA ) )
            {
                String message = ProjectUtils.validateIssueManagement( project, JIRA, "JIRA announcement" );
                if ( message == null )
                {
                    List<Release> jiraReleases = getJiraReleases();
                    releases = releaseUtils.mergeReleases( releases, jiraReleases );
                    getLog().info( "Including issues from JIRA in announcement..." );
                }
                else
                {
                    throw new MojoExecutionException( "Something is wrong with the Issue Management section. "
                        + message );
                }
            }

            if ( issueManagementSystems.contains( TRAC ) )
            {
                String message = ProjectUtils.validateIssueManagement( project, TRAC, "Trac announcement" );
                if ( message == null )
                {
                    List<Release> tracReleases = getTracReleases();
                    releases = releaseUtils.mergeReleases( releases, tracReleases );
                    getLog().info( "Including issues from Trac in announcement..." );
                }
                else
                {
                    throw new MojoExecutionException( "Something is wrong with the Issue Management section. "
                                    + message );
                }
            }

            if ( issueManagementSystems.contains( GIT_HUB ) )
            {
                String message = ProjectUtils.validateIssueManagement( project, GIT_HUB, "GitHub announcement" );
                if ( message == null )
                {
                    List<Release> gitHubReleases = getGitHubReleases();
                    releases = releaseUtils.mergeReleases( releases, gitHubReleases );
                    getLog().info( "Including issues from GitHub in announcement..." );
                }
                else
                {
                    throw new MojoExecutionException( "Something is wrong with the Issue Management section. "
                                    + message );
                }
            }

            // @todo Add more issue management systems here.

            // Follow these steps:
            // 1. Add a constant for the name of the issue management system
            // 2. Add the @parameters needed to configure the issue management system
            // 3. Add a protected List get<IMSname>Releases() method that retrieves a list of releases
            // 4. Merge those releases into the "releases" variable
            // For help with these steps, you can have a look at how this has been done for JIRA or Trac

            // Generate the report
            if ( releases == null || releases.isEmpty() )
            {
                throw new MojoExecutionException( "No releases found in any of the "
                    + "configured issue management systems." );
            }
            else
            {
                doGenerate( releases );
            }
        }
    }