本文整理了Java中org.apache.tools.ant.taskdefs.Zip.setDestFile()
方法的一些代码示例,展示了Zip.setDestFile()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Zip.setDestFile()
方法的具体详情如下:
包路径:org.apache.tools.ant.taskdefs.Zip
类名称:Zip
方法名:setDestFile
[英]The file to create; required.
[中]要创建的文件;必修的。
代码示例来源:origin: org.apache.ant/ant
/**
* This is the name/location of where to
* create the .zip file.
* @param zipFile the path of the zipFile
* @deprecated since 1.5.x.
* Use setDestFile(File) instead.
* @ant.attribute ignore="true"
*/
@Deprecated
public void setZipfile(final File zipFile) {
setDestFile(zipFile);
}
代码示例来源:origin: org.apache.ant/ant
/**
* This is the name/location of where to
* create the file.
* @param file the path of the zipFile
* @since Ant 1.5
* @deprecated since 1.5.x.
* Use setDestFile(File) instead.
* @ant.attribute ignore="true"
*/
@Deprecated
public void setFile(final File file) {
setDestFile(file);
}
代码示例来源:origin: jenkinsci/jenkins
z.setTaskType("zip");
classesJar.getParentFile().mkdirs();
z.setDestFile(classesJar);
z.add(mapper);
z.execute();
代码示例来源:origin: spring-io/initializr
@RequestMapping("/starter.zip")
@ResponseBody
public ResponseEntity<byte[]> springZip(BasicProjectRequest basicRequest)
throws IOException {
ProjectRequest request = (ProjectRequest) basicRequest;
File dir = this.projectGenerator.generateProjectStructure(request);
File download = this.projectGenerator.createDistributionFile(dir, ".zip");
String wrapperScript = getWrapperScript(request);
new File(dir, wrapperScript).setExecutable(true);
Zip zip = new Zip();
zip.setProject(new Project());
zip.setDefaultexcludes(false);
ZipFileSet set = new ZipFileSet();
set.setDir(dir);
set.setFileMode("755");
set.setIncludes(wrapperScript);
set.setDefaultexcludes(false);
zip.addFileset(set);
set = new ZipFileSet();
set.setDir(dir);
set.setIncludes("**,");
set.setExcludes(wrapperScript);
set.setDefaultexcludes(false);
zip.addFileset(set);
zip.setDestFile(download.getCanonicalFile());
zip.execute();
return upload(download, dir, generateFileName(request, "zip"), "application/zip");
}
代码示例来源:origin: org.ow2.jonas.autostart/builder
zip.setDestFile(new File(this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_ROOT_ZIP_FILE));
zip.setUpdate(true);
zip.setProject(p);
zip.setDestFile(new File(this.workdirectory.getAbsolutePath() + FILE_SEPARATOR + JONAS_BASE_ZIP_FILE));
zip.setUpdate(true);
zip.setProject(p);
代码示例来源:origin: org.jvnet.hudson.main/maven-plugin
/**
* Copies a jar file from the master to slave.
*/
private void copyJar(PrintStream log, FilePath dst, Class<?> representative, String seedName) throws IOException, InterruptedException {
// in normal execution environment, the master should be loading 'representative' from this jar, so
// in that way we can find it.
File jar = Which.jarFile(representative);
if(jar.isDirectory()) {
// but during the development and unit test environment, we may be picking the class up from the classes dir
Zip zip = new Zip();
zip.setBasedir(jar);
File t = File.createTempFile(seedName, "jar");
t.delete();
zip.setDestFile(t);
zip.setProject(new Project());
zip.execute();
jar = t;
}
new FilePath(jar).copyTo(dst.child(seedName +".jar"));
log.println("Copied "+seedName+".jar");
}
}
代码示例来源:origin: stackoverflow.com
Project p = new Project();
p.init();
Zip zip = new Zip();
zip.setProject(p);
zip.setDestFile(zipFile); // a java.io.File for the zip you want to create
zip.setBasedir(new File("D:\\reports"));
zip.setIncludes("january/**");
zip.perform();
代码示例来源:origin: stackoverflow.com
zip.setDestFile(zipFile);
zip.setProject(project);
代码示例来源:origin: jenkinsci/maven-plugin
/**
* Copies a jar file from the master to slave.
*/
static FilePath copyJar(PrintStream log, FilePath dst, Class<?> representative, String seedName) throws IOException, InterruptedException {
// in normal execution environment, the master should be loading 'representative' from this jar, so
// in that way we can find it.
File jar = Which.jarFile(representative);
FilePath copiedJar = dst.child(seedName + ".jar");
if (jar.isDirectory()) {
// but during the development and unit test environment, we may be picking the class up from the classes dir
Zip zip = new Zip();
zip.setBasedir(jar);
File t = File.createTempFile(seedName, "jar");
t.delete();
zip.setDestFile(t);
zip.setProject(new Project());
zip.execute();
jar = t;
} else if (copiedJar.exists() && copiedJar.digest().equals(Util.getDigestOf(jar))) {
log.println(seedName + ".jar already up to date");
return copiedJar;
}
// Theoretically could be a race condition on a multi-executor Windows slave; symptom would be an IOException during the build.
// Could perhaps be solved by synchronizing on dst.getChannel() or similar.
new FilePath(jar).copyTo(copiedJar);
log.println("Copied " + seedName + ".jar");
return copiedJar;
}
代码示例来源:origin: org.ow2.jonas.autostart/builder
/**
* Zip jonas-starter folder to jonas-starter.jar.
*/
public void zipStarter() {
Project p = new Project();
Zip zip = new Zip();
zip.setBasedir(getStarterDefaultLocation());
zip.setDestFile(new File(this.starterJarFileLocation.getAbsolutePath(), this.starterJarFileName));
zip.setUpdate(true);
zip.setProject(p);
try {
zip.execute();
setStarterDefaultLocation(new File(this.starterJarFileLocation.getAbsolutePath(), this.starterJarFileName));
renameStarterJarFile();
this.output.write(this.starterJarFileName + " successfully created !");
this.output.write("Location: " + this.starterDefaultLocation);
} catch (Exception e) {
this.output.write("Error in packaging jonas-starter : " + e.getMessage());
}
}
代码示例来源:origin: stackoverflow.com
Project p = new Project();
p.init();
Zip zip = new Zip();
zip.setProject(p);
zip.setDestFile(new File(outputDir, "out.zip"));
FileSet fs = new FileSet();
fs.setProject(p);
fs.setDirectory(targetDir);
zip.addFileset(fs);
zip.perform();
代码示例来源:origin: MarkGao11520/acmen-helper
/**
* 执行压缩操作
* @param srcPathName 需要被压缩的文件/文件夹
* @param dest 生成的zip包的位置
*/
public static void doZipCompress(String srcPathName, String dest) {
File srcdir = new File(srcPathName);
if (!srcdir.exists()){
throw new GlobalException(1 , srcPathName + "不存在" , null);
}
File zipFile = new File(dest);
Project prj = new Project();
Zip zip = new Zip();
zip.setProject(prj);
zip.setDestFile(zipFile);
FileSet fileSet = new FileSet();
fileSet.setProject(prj);
fileSet.setDir(srcdir);
//排除哪些文件或文件夹
fileSet.setExcludes(".DS_Store");
zip.addFileset(fileSet);
zip.execute();
}
代码示例来源:origin: jenkinsci/maven-hpi-plugin
rezip.setDestFile(outputFile);
rezip.setProject(new Project());
ZipFileSet z = new ZipFileSet();
代码示例来源:origin: org.ow2.jonas.autostart/builder
zip.setDestFile(new File(this.workdirectory, JONAS_ROOT_ZIP_FILE));
zip.setUpdate(true);
zip.setProject(project);
zip.setDestFile(new File(this.workdirectory, JONAS_BASE_ZIP_FILE));
zip.setUpdate(true);
zip.setProject(project);
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
z.setTaskType("zip");
classesJar.getParentFile().mkdirs();
z.setDestFile(classesJar);
z.add(mapper);
z.execute();
代码示例来源:origin: ldcsaa/JessMA
/** 获取压缩任务对象 */
@Override
protected Task getTask()
{
Project project = new Project();
Zip zip = new Zip();
FileSet src = getSourceFileSet();
src.setProject(project);
zip.setProject(project);
zip.setDestFile(getTargetFile());
zip.addFileset(src);
if(encoding != null)
zip.setEncoding(encoding);
if(comment != null)
zip.setComment(comment);
return zip;
}
代码示例来源:origin: stackoverflow.com
Zip task = new Zip();
task.init();
task.setDestFile(new File(zipFilePath));
ZipFileSet zipFileSet = new ZipFileSet();
zipFileSet.setPrefix("WEB-INF/lib");
代码示例来源:origin: org.apache.geronimo.framework/geronimo-plugin
} else if ("zip".equals(artifact.getType())) {
Zip zip = new Zip();
zip.setDestFile(dest);
ZipFileSet fs = new ZipFileSet();
fs.setDir(source);
内容来源于网络,如有侵权,请联系作者删除!