private static void unzipExceptClasses(File archive, File destDir, Project prj) { Expand e = new Expand(); e.setProject(prj); e.setTaskType("unzip"); e.setSrc(archive); e.setDest(destDir); PatternSet p = new PatternSet(); p.setExcludes("WEB-INF/classes/"); e.addPatternset(p); e.execute(); }
private void unzip(File archiveFile, File project) { Expand expand = new Expand(); expand.setProject(new Project()); expand.setDest(project); expand.setSrc(archiveFile); expand.execute(); }
private void unzipJar(String jar) throws IOException { File jarFile = new File(jar); LOG.info("unzip jar {} to {}", jar, expandDir.getCanonicalPath()); Expand expand = createExpand(jarFile); expand.execute(); }
/** * Unpacks the zip file containing the container files. * @throws IOException If the ZIP file is broken */ private void unpack() throws IOException { File targetDir = new File(getExtractDir()); File sourceFile = new File(getDownloadDir(), getSourceFileName()); getLogger().info( "Installing container [" + sourceFile + "] in [" + targetDir.getPath() + "]", getClass().getName()); Expand expandTask = createExpandTask(); expandTask.setSrc(sourceFile); expandTask.setDest(targetDir); expandTask.execute(); if (!targetDir.isDirectory()) { throw new IOException("The file [" + sourceFile + "] is broken"); } }
/** * Explodes the plugin into a directory, if necessary. */ private static void explode(File archive, File destDir) throws IOException { if(!destDir.exists()) destDir.mkdirs(); // timestamp check File explodeTime = new File(destDir,".timestamp"); if(explodeTime.exists() && explodeTime.lastModified()==archive.lastModified()) return; // no need to expand // 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 { new FilePath(explodeTime).touch(archive.lastModified()); } catch (InterruptedException e) { throw new AssertionError(e); // impossible } }
/** * Explodes the plugin into a directory, if necessary. */ private static void explode(File archive, File destDir) throws IOException { if(!destDir.exists()) destDir.mkdirs(); // timestamp check File explodeTime = new File(destDir,".timestamp"); if(explodeTime.exists() && explodeTime.lastModified()==archive.lastModified()) return; // no need to expand // 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 { new FilePath(explodeTime).touch(archive.lastModified()); } catch (InterruptedException e) { throw new AssertionError(e); // impossible } }
/** * Explodes the plugin into a directory, if necessary. */ private static void explode(File archive, File destDir) throws IOException { if (!destDir.exists()) { destDir.mkdirs(); } // timestamp check File explodeTime = new File(destDir, ".timestamp"); if (explodeTime.exists() && explodeTime.lastModified() == archive.lastModified()) { return; // no need to expand } // 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 { new FilePath(explodeTime).touch(archive.lastModified()); } catch (InterruptedException e) { throw new AssertionError(e); // impossible } }
/** * Explodes the plugin into a directory, if necessary. */ private static void explode(File archive, File destDir) throws IOException { if(!destDir.exists()) destDir.mkdirs(); // timestamp check File explodeTime = new File(destDir,".timestamp"); if(explodeTime.exists() && explodeTime.lastModified()==archive.lastModified()) return; // no need to expand // 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 { new FilePath(explodeTime).touch(archive.lastModified()); } catch (InterruptedException e) { throw new AssertionError(e); // impossible } }
private File unzip(final File input) { final File tempPluginDir = new File(tempDir, "plugin"); final Expand unzip = new Expand(); unzip.setProject(getProject()); unzip.setTaskName("unzip"); unzip.setSrc(input); unzip.setDest(tempPluginDir); unzip.execute(); return findBaseDir(tempPluginDir); }
private void extractWar(File file) throws CreatorExecutionException { Project project = new Project(); Expand unArchiver = new Expand(); unArchiver.setProject(project); unArchiver.setSrc(file); unArchiver.setDest(workingDirectory); unArchiver.execute(); }
private void extractWar(File file) throws CreatorExecutionException { Project project = new Project(); Expand unArchiver = new Expand(); unArchiver.setProject(project); unArchiver.setSrc(file); unArchiver.setDest(workingDirectory); unArchiver.execute(); }
private void unzip(File src, File dest) { Project dummyProject = new Project(); dummyProject.init(); Expand antUnzip = new Expand(); antUnzip.setProject(dummyProject); antUnzip.setSrc(src); antUnzip.setDest(dest); antUnzip.execute(); // ant doesn't preserve permission bits // need to restore them manually Chmod chmod = new Chmod(); chmod.setProject(dummyProject); chmod.setDir(new File(src.getAbsolutePath().replaceAll(".zip", ""))); chmod.setPerm("a+rx"); chmod.setIncludes("**/**"); chmod.execute(); }
e.setSrc(CVSSCM.getArchiveFile(build)); e.setTaskType("unzip"); e.execute();
private static void unzipExceptClasses(File archive, File destDir, Project prj) { Expand e = new Expand(); e.setProject(prj); e.setTaskType("unzip"); e.setSrc(archive); e.setDest(destDir); PatternSet p = new PatternSet(); p.setExcludes("WEB-INF/classes/"); e.addPatternset(p); e.execute(); }
e.setSrc(CVSSCM.getArchiveFile(build)); e.setTaskType("unzip"); e.execute();
private void extractZip(final File source, final File target) throws BuildException { final Expand e = new Expand(); e.setProject(getProject()); e.setOverwrite(false); if (excludeManifest) { final PatternSet ps = new PatternSet(); ps.setExcludes("META-INF,META-INF/MANIFEST.MF"); //NOI18N e.addPatternset(ps); } e.setSrc(source); e.setDest(target); e.execute(); }
private void extractZip(final File source, final File target) throws BuildException { final Expand e = new Expand(); e.setProject(getProject()); e.setOverwrite(false); if (excludeManifest) { final PatternSet ps = new PatternSet(); ps.setExcludes("META-INF,META-INF/MANIFEST.MF"); //NOI18N e.addPatternset(ps); } e.setSrc(source); e.setDest(target); e.execute(); }
/** * Test start with one expanded WAR. * @throws Exception If anything goes wrong. */ public void testStartWithOneExpandedWarDeployed() throws Exception { // The Apache Geronimo server doesn't support expanded WARs if (getContainer().getId().startsWith("geronimo")) { return; } // Copy the war from the Maven local repository in order to expand it File artifactDir = new File(getTestData().targetDir).getParentFile(); Expand expandTask = (Expand) new AntUtils().createProject().createTask("unwar"); expandTask.setDest(new File(artifactDir, "expanded-war")); expandTask.setSrc(new File(getTestData().getTestDataFileFor("expanded-war"))); expandTask.execute(); Deployable war = new DefaultDeployableFactory().createDeployable(getContainer().getId(), new File(artifactDir, "expanded-war").getPath(), DeployableType.WAR); getLocalContainer().getConfiguration().addDeployable(war); URL warPingURL = new URL("http://localhost:" + getTestData().port + "/expanded-war" + "/index.html"); startAndStop(warPingURL); } }
/** * Test expanded WAR with a <code>context.xml</code> file. * @throws Exception If anything goes wrong. */ public void testExpandedWarWithContextXmlFile() throws Exception { // Copy the war from the Maven local repository in order to expand it File artifactDir = new File(getTestData().targetDir).getParentFile(); Expand expandTask = (Expand) new AntUtils().createProject().createTask("unwar"); expandTask.setDest(new File(artifactDir, "tomcat-context")); expandTask.setSrc(new File(getTestData().getTestDataFileFor("tomcatcontext-war"))); expandTask.execute(); Deployable war = new DefaultDeployableFactory().createDeployable(getContainer().getId(), new File(artifactDir, "tomcat-context").getPath(), DeployableType.WAR); getLocalContainer().getConfiguration().addDeployable(war); URL warPingURL = new URL("http://localhost:" + getTestData().port + "/tomcat-context/"); getLocalContainer().start(); PingUtils.assertPingTrue("tomcat context war not started", "Test value is [test value]", warPingURL, getLogger()); getLocalContainer().stop(); PingUtils.assertPingFalse("tomcat context war not stopped", warPingURL, getLogger()); } }
expandTask.setSrc(new File(getTestData().getTestDataFileFor("tomcatcontext-war-link-simple" + "-jar"))); expandTask.execute();