org.apache.tools.ant.taskdefs.Expand.setProject()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中org.apache.tools.ant.taskdefs.Expand.setProject()方法的一些代码示例,展示了Expand.setProject()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Expand.setProject()方法的具体详情如下:
包路径:org.apache.tools.ant.taskdefs.Expand
类名称:Expand
方法名:setProject

Expand.setProject介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

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();
}

代码示例来源:origin: spring-io/initializr

private void unzip(File archiveFile, File project) {
  Expand expand = new Expand();
  expand.setProject(new Project());
  expand.setDest(project);
  expand.setSrc(archiveFile);
  expand.execute();
}

代码示例来源:origin: stackoverflow.com

Project p = new Project();
p.init();
Expand ex = new Expand();
ex.setProject(p);
ex.setSrc(new File("myArchive.zip"));
ex.setDest(new File("targetDir"));
ex.perform();

代码示例来源:origin: org.metaeffekt.core/ae-inventory-processor

if (zipExtensions.contains(extension)) {
  Expand expandTask = new Expand();
  expandTask.setProject(project);
  File targetFolder = new File(archive.getParentFile(), "[" + archive.getName() + "]");
  targetFolder.mkdirs();

代码示例来源:origin: hudson/hudson-2.x

/**
 * 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
  }
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * 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
  }
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * 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
  }
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * 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
  }
}

代码示例来源:origin: HuaweiBigData/StreamCQL

private Expand createExpand(File jarFile)
{
  String outputDir = expandDir + File.separator + jarFile.getName();
  Project prj = new Project();
  FileSet fileSet = createFileSetForJarFile(jarFile, prj);
  PatternSet patternSet = createPatternSet(prj);
  Expand expand = new Expand();
  expand.setProject(prj);
  expand.setOverwrite(true);
  expand.setDest(new File(outputDir));
  expand.addFileset(fileSet);
  expand.addPatternset(patternSet);
  return expand;
}

代码示例来源:origin: dita-ot/dita-ot

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);
}

代码示例来源:origin: io.tesla.jettyconsole/jetty-console-creator

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();
}

代码示例来源:origin: org.simplericity.jettyconsole/jetty-console-creator

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();
}

代码示例来源:origin: org.terracotta/native-tool

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();
}

代码示例来源:origin: org.hudsonci.plugins/cvs

e.setProject(new org.apache.tools.ant.Project());
e.setDest(destdir);
e.setSrc(CVSSCM.getArchiveFile(build));

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

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();
}

代码示例来源:origin: org.jvnet.hudson.plugins/cvs

e.setProject(new org.apache.tools.ant.Project());
e.setDest(destdir);
e.setSrc(CVSSCM.getArchiveFile(build));

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2me-common-ant

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();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-mobility-antext

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();
}

代码示例来源:origin: net.sf.antenna/antenna

expand.setProject(getProject());
expand.setTaskName(getTaskName());
expand.setSrc(getJarFile());

代码示例来源:origin: ldcsaa/JessMA

/** 获取解压任务对象 */
  @Override
  protected Task getTask()
  {
    Project project    = new Project();
    Expand expand    = getExpand();
    PatternSet ps    = getPatternSet();

    expand.setProject(project);
    expand.setSrc(getSourceFile());
    expand.setDest(getTargetDir());
    expand.setOverwrite(isOverwrite());
    
    if(ps != null)
    {
      ps.setProject(project);
      expand.addPatternset(ps);
    }

    return expand;
  }
}

相关文章