plugin/checkstyle/src/main/java/se/jguru/nazgul/tools/plugin/checkstyle/rss/VelocityTemplate.java
public void generate( String outputFilename, String template, Context context )
        throws VelocityException, MojoExecutionException, IOException
    {
        Writer writer = null;

        try
        {
            File f = new File( outputFilename );

            if ( !f.getParentFile().exists() )
            {
                f.getParentFile().mkdirs();
            }

            writer = new FileWriter( f );

            getVelocity().getEngine().mergeTemplate( templateDirectory + "/" + template, context, writer );
        }
        catch ( ResourceNotFoundException e )
        {
            throw new ResourceNotFoundException( "Template not found: " + templateDirectory + "/" + template, e );
        }
        catch ( VelocityException | IOException e )
        {
            throw e; // to get past generic catch for Exception.
        }
        catch ( Exception e )
        {
            throw new MojoExecutionException( e.getMessage(), e );
        }
        finally
        {
            if ( writer != null )
            {
                writer.flush();
                writer.close();

                getLog().debug( "File " + outputFilename + " created..." );
            }
        }
    }
public void generate( String outputFilename, String template, Context context )
        throws VelocityException, MojoExecutionException, IOException
    {
        Writer writer = null;

        try
        {
            File f = new File( outputFilename );

            if ( !f.getParentFile().exists() )
            {
                f.getParentFile().mkdirs();
            }

            writer = new FileWriter( f );

            getVelocity().getEngine().mergeTemplate( templateDirectory + "/" + template, context, writer );
        }
        catch ( ResourceNotFoundException e )
        {
            throw new ResourceNotFoundException( "Template not found: " + templateDirectory + "/" + template, e );
        }
        catch ( VelocityException | IOException e )
        {
            throw e; // to get past generic catch for Exception.
        }
        catch ( Exception e )
        {
            throw new MojoExecutionException( e.getMessage(), e );
        }
        finally
        {
            if ( writer != null )
            {
                writer.flush();
                writer.close();

                getLog().debug( "File " + outputFilename + " created..." );
            }
        }
    }
Using a specified Velocity Template and provided context, create the outputFilename.

@param outputFilename the file to be generated.
@param template       the velocity template to use.
@param context        the velocity context map.
@throws VelocityException if the template was not found or any other Velocity exception.
@throws MojoExecutionException
@throws IOException