protected void unpack(File file, File location, String logName, boolean overwrite, String[] includes,
        String[] excludes) throws MojoExecutionException
    {
        try {
            ZipUnArchiver unArchiver = new ZipUnArchiver();
            unArchiver.setEncoding(this.encoding);
            unArchiver.enableLogging(new ConsoleLogger(Logger.LEVEL_ERROR, logName));
            unArchiver.setSourceFile(file);
            unArchiver.setDestDirectory(location);

            FileSelector[] selectors;

            IncludeExcludeFileSelector fs = new IncludeExcludeFileSelector();
            fs.setIncludes(includes);
            fs.setExcludes(excludes);

            // Ensure that we don't overwrite XML document files present in this project since
            // we want those to be used and not the ones in the dependent XAR.
            unArchiver.setOverwrite(overwrite);

            if (!overwrite) {
                // Do not unpack any package.xml file in dependent XARs. We'll generate a complete
                // one automatically.
                IncludeExcludeFileSelector fs2 = new IncludeExcludeFileSelector();
                fs2.setExcludes(new String[] {PACKAGE_XML});
                selectors = new FileSelector[] {fs, fs2};
            } else {
                selectors = new FileSelector[] {fs};
            }

            unArchiver.setFileSelectors(selectors);

            unArchiver.extract();
        } catch (Exception e) {
            throw new MojoExecutionException(String.format("Error unpacking file [%s] to [%s]", file, location), e);
        }
    }
protected void unpack ( File file , File location , String logName , boolean overwrite , String [ ] includes , String [ ] excludes ) throws MojoExecutionException { try { ZipUnArchiver unArchiver = new ZipUnArchiver ( ) ; unArchiver . setEncoding ( this . encoding ) ; unArchiver . enableLogging ( new ConsoleLogger ( Logger . LEVEL_ERROR , logName ) ) ; unArchiver . setSourceFile ( file ) ; unArchiver . setDestDirectory ( location ) ; FileSelector [ ] selectors ; IncludeExcludeFileSelector fs = new IncludeExcludeFileSelector ( ) ; fs . setIncludes ( includes ) ; fs . setExcludes ( excludes ) ; unArchiver . setOverwrite ( overwrite ) ; if ( ! overwrite ) { IncludeExcludeFileSelector fs2 = new IncludeExcludeFileSelector ( ) ; fs2 . setExcludes ( new String [ ] { PACKAGE_XML } ) ; selectors = new FileSelector [ ] { fs , fs2 } ; } else { selectors = new FileSelector [ ] { fs } ; } unArchiver . setFileSelectors ( selectors ) ; unArchiver . extract ( ) ; } catch ( Exception e ) { throw new MojoExecutionException ( String . format ( "Error unpacking file [%s] to [%s]" , file , location ) , e ) ; } }
Unpacks the XAR file (exclude the package.xml file if it exists).

@param file the file to be unpacked.
@param location the location where to put the unpacket files.
@param logName the name use with {@link ConsoleLogger}.
@param overwrite indicate if extracted files has to overwrite existing ones.
@throws MojoExecutionException error when unpacking the file.