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

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

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

AntBuilder.invokeMethod介绍

暂无

代码示例

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

  1. public void prepare(File pathToDocx, String templateKey) throws IOException {
  2. File dir = getTemplateUnzipFolder(templateKey);
  3. if (pathToDocx.exists() && pathToDocx.isFile()) {
  4. AntBuilder antBuilder = new AntBuilder();
  5. HashMap<String, Object> params = new HashMap<String, Object>();
  6. params.put("src", pathToDocx);
  7. params.put("dest", dir);
  8. params.put("overwrite", "true");
  9. antBuilder.invokeMethod("unzip", params);
  10. } else {
  11. throw new FileNotFoundException(String.format("Cannot find docx template: '%s'",
  12. pathToDocx.getAbsolutePath()));
  13. }
  14. }

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

  1. import groovy.util.AntBuilder ;
  2. import java.io.File ;
  3. import java.util.HashMap ;
  4. public class Test {
  5. public static void main( String[] args ) throws Exception {
  6. if( args.length != 2 ) {
  7. System.err.println( "Need 2 args. Input zip file and output folder" ) ;
  8. System.exit( 1 ) ;
  9. }
  10. final File file = new File( args[ 0 ] ) ;
  11. final File outputFolder = new File( args[ 1 ] ) ;
  12. AntBuilder ant = new AntBuilder() ;
  13. ant.invokeMethod( "unzip", new HashMap() {{
  14. put( "src", file.getPath() ) ;
  15. put( "dest", outputFolder.getPath() ) ;
  16. }} ) ;
  17. }
  18. }

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

  1. final AntBuilder ant = new AntBuilder();
  2. ant.invokeMethod("echo", "copy & sync gestartet...");
  3. ant.invokeMethod("sync", new Object[] { new HashMap<String, String>() {
  4. {
  5. this.put("todir", "./myordner2");
  6. this.put("verbose", "yes");
  7. }
  8. }, new Closure<Object>(null) {
  9. @Override
  10. public Object call(Object... args) {
  11. ant.invokeMethod("fileset", new Object[] {
  12. new HashMap<String, String>() {
  13. {
  14. this.put("dir", "c:/myordner1/test");
  15. }
  16. }});
  17. return null;
  18. }
  19. } });

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

  1. return super.invokeMethod(name, arguments);

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

  1. return super.invokeMethod(name, arguments);

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

  1. return super.invokeMethod(name, arguments);

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

  1. protected void processResult(File destDocx, String templateKey, TemplateContent content) throws IOException {
  2. File tmpProcessFolder = TemplateFileManager.getInstance().createTmpProcessFolder();
  3. destDocx.delete();
  4. FileUtils.deleteDirectory(tmpProcessFolder);
  5. FileUtils
  6. .copyDirectory(TemplateFileManager.getInstance().getTemplateUnzipFolder(templateKey), tmpProcessFolder);
  7. for (ContentItem item : content.getItems()) {
  8. FileUtils.writeStringToFile(new File(tmpProcessFolder, "word/" + item.getIdentifier()), item.getContent(),
  9. "UTF-8");
  10. }
  11. AntBuilder antBuilder = new AntBuilder();
  12. HashMap<String, Object> params1 = new HashMap<String, Object>();
  13. params1.put("destfile", destDocx);
  14. params1.put("basedir", tmpProcessFolder);
  15. params1.put("includes", "**/*.*");
  16. params1.put("excludes", "");
  17. params1.put("encoding", "UTF-8");
  18. antBuilder.invokeMethod("zip", params1);
  19. FileUtils.deleteDirectory(tmpProcessFolder);
  20. }

相关文章