public File createArchive()
        throws MojoExecutionException
    {
        File jarFile = getJarFile( outputDirectory, finalName, getClassifier() );

        MavenArchiver archiver = new MavenArchiver();

        archiver.setArchiver( jarArchiver );

        archiver.setOutputFile( jarFile );

        archive.setForced( forceCreation );

        try
        {
            File contentDirectory = getClassesDirectory();
            if ( !contentDirectory.exists() )
            {
                getLog().warn( "JAR will be empty - no content was marked for inclusion!" );
            }
            else
            {
                archiver.getArchiver().addDirectory( contentDirectory, DEFAULT_INCLUDES, DEFAULT_EXCLUDES );
            }

            archiver.createArchive(mavenSession, project, archive);

            return jarFile;
        }
        catch ( Exception e )
        {
            throw new MojoExecutionException( "Error assembling JAR", e );
        }
    }
public File createArchive ( ) throws MojoExecutionException { File jarFile = getJarFile ( outputDirectory , finalName , getClassifier ( ) ) ; MavenArchiver archiver = new MavenArchiver ( ) ; archiver . setArchiver ( jarArchiver ) ; archiver . setOutputFile ( jarFile ) ; archive . setForced ( forceCreation ) ; try { File contentDirectory = getClassesDirectory ( ) ; if ( ! contentDirectory . exists ( ) ) { getLog ( ) . warn ( "JAR will be empty - no content was marked for inclusion!" ) ; } else { archiver . getArchiver ( ) . addDirectory ( contentDirectory , DEFAULT_INCLUDES , DEFAULT_EXCLUDES ) ; } archiver . createArchive ( mavenSession , project , archive ) ; return jarFile ; } catch ( Exception e ) { throw new MojoExecutionException ( "Error assembling JAR" , e ) ; } }
Generates the JAR.

@return a {@link java.io.File} object.
@throws org.apache.maven.plugin.MojoExecutionException if any.