private File getBasedir()

in src/main/java/org/apache/maven/plugins/linkcheck/LinkcheckReport.java [335:382]


    private File getBasedir()
        throws MojoExecutionException
    {
        File basedir;

        if ( forceSite )
        {
            basedir = new File( linkcheckOutput.getParentFile(), "tmpsite" );
            basedir.mkdirs();

            List<File> documents = null;
            try
            {
                documents = FileUtils.getFiles( basedir, "**/*.html", null );
            }
            catch ( IOException e )
            {
                getLog().error( "IOException: " + e.getMessage() );
                getLog().debug( e );
            }

            // if the site was not already generated, invoke it
            if ( documents == null || documents.size() == 0 )
            {
                getLog().info( "Invoking the maven-site-plugin to ensure that all files are generated..." );

                try
                {
                    SiteInvoker invoker = new SiteInvoker( localRepository, getLog() );
                    invoker.invokeSite( project, basedir );
                }
                catch ( IOException e )
                {
                    throw new MojoExecutionException( "IOException: " + e.getMessage(), e );
                }
            }
        }
        else
        {
            getLog().warn( "The number of documents analyzed by Linkcheck could differ from the actual "
                               + "number of documents!" );

            basedir = outputDirectory;
            basedir.mkdirs();
        }

        return basedir;
    }