The following features are implemented:
16051606160716081609161016111612161316141615161616171618
{ // Get the name of a temporary output folder File outFolder = FileUtils.getFileUtils().createTempFile(TEMP_FILE_PREFIX, "", null, false, false); // Unzip the zip file Expand unzipper = (Expand)m_project.createTask("unzip"); unzipper.setSrc(zipFileSet.getSrc(m_project)); unzipper.setDest(outFolder); unzipper.execute(); // Change the file set to use the new directory zipFileSet.setSrcResource(null); zipFileSet.setDir(outFolder);
1718192021222324
private String jarPath; private String pathInJar = ""; private Expand expandTask; public ExtractedDirContent() { expandTask = new Expand(); expandTask.setTaskName("unzip"); }
288289290291292293294295296297298299300301
if (!installMarker.exists()) { log.info("Installing assembly..."); FileUtils.forceMkdir(geronimoHome); Expand unzip = (Expand)createTask("unzip"); unzip.setSrc(assemblyArchive); unzip.setDest(installDirectory.getCanonicalFile()); unzip.execute(); // Make scripts executable, since Java unzip ignores perms Chmod chmod = (Chmod)createTask("chmod"); chmod.setPerm("ugo+rx"); chmod.setDir(geronimoHome);
2526272829303132333435363738
} public static void unzip(Path tempZipFile, Path tempExtractedFolder) { LOGGER.info("Unzipping " + tempZipFile + " to " + tempExtractedFolder); Expand expand = new Expand(); expand.setDest(tempExtractedFolder.toFile()); expand.setSrc(tempZipFile.toFile()); expand.setProject(AntUtil.builder().getProject()); expand.setTaskName("unzip"); expand.execute(); }
381382383384385386387388389390391392393394395396
// delete the contents so that old files won't interfere with new files Util.deleteContentsRecursive(destDir); try { Expand e = new Expand(); e.setProject(new Project()); e.setTaskType("unzip"); e.setSrc(archive); e.setDest(destDir); e.execute(); } catch (BuildException x) { throw new IOException2("Failed to expand " + archive,x); } try {
147148149150151152153154155156157158159160
System.out.println( "Installing Maven in " + mavenHome ); FileUtils.deleteDirectory( mavenHome ); Expand expand = new Expand(); expand.setSrc( file ); expand.setDest( new File( destDir ).getParentFile() ); expand.execute(); if ( !mavenHome.exists() ) { throw new Exception( "Maven was not installed in " + mavenHome ); }
126127128129130131132133134135136137138139
final File tempDir = new File(baseDir, System.currentTimeMillis() + ".dir"); if (!tempDir.mkdir()) { throw new IllegalStateException("Failed to create temporary directory"); } tempDir.deleteOnExit(); final Expand expander = new Expand(); expander.setDest(tempDir); expander.setSrc(new File(uri)); expander.execute(); final File dir = new File(tempDir, resourcePath); if ( dir.exists() && dir.isDirectory() ) { return dir; }
144145146147148149150151152153154155156157158159160
String fileExtension = source.getName().substring( source.getName().lastIndexOf( '.' ) ); if ( fileExtension.equalsIgnoreCase( ".jar" ) || fileExtension.equalsIgnoreCase( ".zip" ) || fileExtension.equalsIgnoreCase( ".war" ) || fileExtension.equalsIgnoreCase( ".sar" ) ) { log.info( "\t\t\t ... expanding " + source + "\n\t\t\t => to " + dest ); Expand expand = new Expand(); expand.setSrc( source ); expand.setOverwrite( true ); expand.setDest( dest ); try { expand.execute(); continue; } catch ( Exception e ) { throw new MojoFailureException( "Failed to expaned packagedFile " + source + ": " + e.getMessage() );