public void generate( File outputDir, Collection<ResolvedJarResource> jarResources )
            throws MojoExecutionException
    {

        if ( outputDir == null )
        {
            throw new IllegalArgumentException( "outputDir must not be null" );
        }

        BufferedWriter writer = null;

        try
        {
            File versionXmlFile = new File( outputDir, "version.xml" );
            writer = new BufferedWriter( WriterFactory.newWriter( versionXmlFile, encoding ) );

            generateXml( writer, jarResources );

        }
        catch ( IOException e )
        {
            throw new MojoExecutionException( "Unable to create the version.xml file", e );
        }
        finally
        {
            if ( writer != null )
            {
                try
                {
                    writer.close();
                }
                catch ( IOException e )
                {
                    // do nothing
                }
            }
        }

    }
public void generate ( File outputDir , Collection < ResolvedJarResource > jarResources ) throws MojoExecutionException { if ( outputDir == null ) { throw new IllegalArgumentException ( "outputDir must not be null" ) ; } BufferedWriter writer = null ; try { File versionXmlFile = new File ( outputDir , "version.xml" ) ; writer = new BufferedWriter ( WriterFactory . newWriter ( versionXmlFile , encoding ) ) ; generateXml ( writer , jarResources ) ; } catch ( IOException e ) { throw new MojoExecutionException ( "Unable to create the version.xml file" , e ) ; } finally { if ( writer != null ) { try { writer . close ( ) ; } catch ( IOException e ) { } } } }
Generates a file named <code>version.xml</code> in the given <code>outputDir</code>.
The generated file will contain resource elements for each of the JarResource
objects in the given collection.

@param outputDir    The directory in which the file will be generated. Must not be null.
@param jarResources The collection of JarResources for which a resource
element will be created in the generated file.
@throws MojoExecutionException if an error occurs generating the file.