groovy.util.AntBuilder.invokeMethod()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(105)

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

AntBuilder.invokeMethod介绍

暂无

代码示例

代码示例来源:origin: snowindy/scriptlet4docx

public void prepare(File pathToDocx, String templateKey) throws IOException {
  File dir = getTemplateUnzipFolder(templateKey);
  if (pathToDocx.exists() && pathToDocx.isFile()) {
    AntBuilder antBuilder = new AntBuilder();
    HashMap<String, Object> params = new HashMap<String, Object>();
    params.put("src", pathToDocx);
    params.put("dest", dir);
    params.put("overwrite", "true");
    antBuilder.invokeMethod("unzip", params);
  } else {
    throw new FileNotFoundException(String.format("Cannot find docx template: '%s'",
        pathToDocx.getAbsolutePath()));
  }
}

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

import groovy.util.AntBuilder ;
import java.io.File ;
import java.util.HashMap ;

public class Test {
 public static void main( String[] args ) throws Exception {
  if( args.length != 2 ) {
   System.err.println( "Need 2 args.  Input zip file and output folder" ) ;
   System.exit( 1 ) ;
  }
  final File file = new File( args[ 0 ] ) ;
  final File outputFolder = new File( args[ 1 ] ) ;
  AntBuilder ant = new AntBuilder() ;
  ant.invokeMethod( "unzip", new HashMap() {{
   put( "src", file.getPath() ) ;
   put( "dest", outputFolder.getPath() ) ;
  }} ) ;
 }
}

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

final AntBuilder ant = new AntBuilder();
ant.invokeMethod("echo", "copy & sync gestartet...");

ant.invokeMethod("sync", new Object[] { new HashMap<String, String>() {
 {
  this.put("todir", "./myordner2");
  this.put("verbose", "yes");
 }
}, new Closure<Object>(null) {
 @Override
 public Object call(Object... args) {
  ant.invokeMethod("fileset", new Object[] {
    new HashMap<String, String>() {
     {
      this.put("dir", "c:/myordner1/test");
     }
    }});
  return null;
 }
} });

代码示例来源:origin: org.codehaus.gant/gant_groovy1.8

return super.invokeMethod(name, arguments);

代码示例来源:origin: org.codehaus.gant/gant_groovy2.1

return super.invokeMethod(name, arguments);

代码示例来源:origin: org.codehaus.gant/gant_groovy2.0

return super.invokeMethod(name, arguments);

代码示例来源:origin: snowindy/scriptlet4docx

protected void processResult(File destDocx, String templateKey, TemplateContent content) throws IOException {
  File tmpProcessFolder = TemplateFileManager.getInstance().createTmpProcessFolder();
  destDocx.delete();
  FileUtils.deleteDirectory(tmpProcessFolder);
  FileUtils
      .copyDirectory(TemplateFileManager.getInstance().getTemplateUnzipFolder(templateKey), tmpProcessFolder);
  for (ContentItem item : content.getItems()) {
    FileUtils.writeStringToFile(new File(tmpProcessFolder, "word/" + item.getIdentifier()), item.getContent(),
        "UTF-8");
  }
  AntBuilder antBuilder = new AntBuilder();
  HashMap<String, Object> params1 = new HashMap<String, Object>();
  params1.put("destfile", destDocx);
  params1.put("basedir", tmpProcessFolder);
  params1.put("includes", "**/*.*");
  params1.put("excludes", "");
  params1.put("encoding", "UTF-8");
  antBuilder.invokeMethod("zip", params1);
  FileUtils.deleteDirectory(tmpProcessFolder);
}

相关文章