private void unpackFile ( File file ) throws MojoExecutionException { // initialize unpacker to validate patterns ContentUnpackerProperties props = new ContentUnpackerProperties ( ) ; props . setExcludeFiles ( this . excludeFiles ) ; props . setExcludeNodes ( this . excludeNodes ) ; props . setExcludeProperties ( this . excludeProperties ) ; props . setExcludeMixins ( this . excludeMixins ) ; ContentUnpacker unpacker = new ContentUnpacker ( props ) ; // validate output directory if ( this . unpackDirectory == null ) { throw new MojoExecutionException ( "No unpack directory specified." ) ; } if ( ! this . unpackDirectory . exists ( ) ) { this . unpackDirectory . mkdirs ( ) ; } // remove existing content if ( this . unpackDeleteDirectories != null ) { for ( String directory : unpackDeleteDirectories ) { File directoryFile = FileUtils . getFile ( this . unpackDirectory , directory ) ; if ( directoryFile . exists ( ) ) { if ( ! deleteDirectoryWithRetries ( directoryFile , 0 ) ) { throw new MojoExecutionException ( "Unable to delete existing content from " + directoryFile . getAbsolutePath ( ) ) ; } } } } // unpack file unpacker . unpack ( file , this . unpackDirectory ) ; getLog ( ) . info ( "Package unpacked to " + this . unpackDirectory . getAbsolutePath ( ) ) ; }
Unpack content package