private void checkProjectSite()

in src/main/java/org/apache/maven/plugin/docck/CheckPluginDocumentationMojo.java [135:204]


    private void checkProjectSite( MavenProject project, DocumentationReporter reporter )
    {
        File projectSiteDirectory = new File( project.getBasedir(), siteDirectory );

        // check for site.xml
        File siteXml = new File( projectSiteDirectory, "site.xml" );

        if ( !siteXml.exists() )
        {
            reporter.error( "site.xml is missing." );
        }
        else
        {
            
            try ( Reader streamReader = ReaderFactory.newXmlReader( siteXml ) )
            {
                String siteHtml = IOUtil.toString( streamReader );

                if ( !siteHtml.contains( "href=\"index.html\"" ) )
                {
                    reporter.error( "site.xml is missing the link to: index.html \"Introduction\"." );
                }

                if ( !siteHtml.contains( "href=\"usage.html\"" ) )
                {
                    reporter.error( "site.xml is missing the link to: usage.html \"Usage\"." );
                }

                if ( !siteHtml.contains( "href=\"plugin-info.html\"" ) )
                {
                    reporter.error( "site.xml is missing the link to: plugin-info.html \"Goals\"." );
                }

                if ( !siteHtml.contains( "href=\"faq.html\"" ) )
                {
                    reporter.error( "site.xml is missing the link to: faq.html \"FAQ\"." );
                }
            }
            catch ( IOException e )
            {
                reporter.error( "Unable to read site.xml file: \'" + siteXml.getAbsolutePath() + "\'.\nError: "
                    + e.getMessage() );
            }
        }

        // check for index.(apt|html|xml)[.vm]
        if ( !findFiles( projectSiteDirectory, "index" ) )
        {
            reporter.error( "There is no \'index\' file in your site directory (in apt|html|xml[.vm] format)." );
        }

        // check for usage.(apt|html|xml)[.vm]
        if ( !findFiles( projectSiteDirectory, "usage" ) )
        {
            reporter.error( "There is no \'usage\' file in your site directory (in apt|html|xml[.vm] format)." );
        }

        // check for **/examples/**.(apt|html|xml)[.vm] or **/example*.(apt|html|xml)[.vm]
        if ( !findFiles( projectSiteDirectory, "**/examples/*" ) && !findFiles( projectSiteDirectory, "**/example*" ) )
        {
            reporter.error( "There are no example files in your site directory (in apt|html|xml[.vm] format)."
                + " They should either be called \'example*.(apt|html|xml)[.vm]\'"
                + " or they should be located in the \'examples\' directory." );
        }

        if ( !findFiles( projectSiteDirectory, "faq" ) )
        {
            reporter.error( "There is no \'faq\' file in your site directory (in apt|fml|html|xml[.vm] format)." );
        }
    }