zipTask.execute();
}
// TAR Archive
else if ( archiveType.equalsIgnoreCase( "tar" ) )
{
Tar tarTask = new Tar();
tarTask.setProject( project );
tarTask.setDestFile( finalFile );
tarTask.setBasedir( getTargetDirectory() );
tarTask.setIncludes( getArchiveDirectory().getName() + "/**" );
tarTask.execute();
}
// TAR.GZ Archive
else if ( archiveType.equalsIgnoreCase( "tar.gz" ) )
{
File tarFile = new File( mojo.getOutputDirectory(), target.getId() + ".tar" );
Tar tarTask = new Tar();
tarTask.setProject( project );
tarTask.setDestFile( tarFile );
tarTask.setBasedir( getTargetDirectory() );
tarTask.setIncludes( getArchiveDirectory().getName() + "/**" );
tarTask.execute();
GZip gzipTask = new GZip();
gzipTask.setProject( project );
gzipTask.setDestfile( finalFile );
gzipTask.setSrc( tarFile );
gzipTask.execute();
if ( !tarFile.delete() )
{
Exception e = new IOException( I18n.err( I18n.ERR_113_COULD_NOT_DELETE_FILE_OR_DIRECTORY, tarFile ) );
log.error( e.getLocalizedMessage() );
throw new MojoFailureException( e.getMessage() );
}
}
// TAR.BZ2 Archive
else if ( archiveType.equalsIgnoreCase( "tar.bz2" ) )
{
File tarFile = new File( mojo.getOutputDirectory(), target.getId() + ".tar" );
Tar tarTask = new Tar();
tarTask.setProject( project );
tarTask.setDestFile( tarFile );
tarTask.setBasedir( getTargetDirectory() );
tarTask.setIncludes( getArchiveDirectory().getName() + "/**" );
tarTask.execute();
BZip2 bzip2Task = new BZip2();
bzip2Task.setProject( project );
bzip2Task.setDestfile( finalFile );
bzip2Task.setSrc( tarFile );