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

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

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

AntBuilder.getProject介绍

[英]# Gets the Ant project in which the tasks are executed
[中]#获取在其中执行任务的Ant项目

代码示例

代码示例来源:origin: apache/groovy

private Target onStartTarget(final Attributes attrs, String tagName, String ns) {
  final Target target = new Target();
  target.setProject(project);
  target.setLocation(new Location(antXmlContext.getLocator()));
  try {
    antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
    final Target newTarget = getProject().getTargets().get(attrs.getValue("name"));
    // execute dependencies (if any)
    final Vector<Target> targets = new Vector<Target>();
    for (final Enumeration<String> deps = newTarget.getDependencies(); deps.hasMoreElements();) {
      final String targetName = deps.nextElement();
      targets.add(project.getTargets().get(targetName));
    }
    getProject().executeSortedTargets(targets);
    antXmlContext.setCurrentTarget(newTarget);
    return newTarget;
  }
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  return null;
}

代码示例来源:origin: apache/groovy

private Target onDefineTarget(final Attributes attrs, String tagName, String ns) {
  final Target target = new Target();
  target.setProject(project);
  target.setLocation(new Location(antXmlContext.getLocator()));
  try {
    antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
    final Target newTarget = getProject().getTargets().get(attrs.getValue("name"));
    antXmlContext.setCurrentTarget(newTarget);
    definingTarget = newTarget;
    return newTarget;
  }
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  return null;
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

public static void main(String[] args) {
  final GroovyShell shell = new GroovyShell(new Binding());
  final Groovy groovy = new Groovy();
  for (int i = 1; i < args.length; i++) {
    final Commandline.Argument argument = groovy.createArg();
    argument.setValue(args[i]);
  }
  final AntBuilder builder = new AntBuilder();
  groovy.setProject(builder.getProject());
  groovy.parseAndRunScript(shell, null, null, null, new File(args[0]), builder);
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

public static void main(String[] args) {
  final GroovyShell shell = new GroovyShell(new Binding());
  final Groovy groovy = new Groovy();
  for (int i = 1; i < args.length; i++) {
    final Commandline.Argument argument = groovy.createArg();
    argument.setValue(args[i]);
  }
  final AntBuilder builder = new AntBuilder();
  groovy.setProject(builder.getProject());
  groovy.parseAndRunScript(shell, null, null, null, new File(args[0]), builder);
}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

public static void main(String[] args) {
  final GroovyShell shell = new GroovyShell(new Binding());
  final Groovy groovy = new Groovy();
  for (int i = 1; i < args.length; i++) {
    final Commandline.Argument argument = groovy.createArg();
    argument.setValue(args[i]);
  }
  final AntBuilder builder = new AntBuilder();
  groovy.setProject(builder.getProject());
  groovy.parseAndRunScript(shell, null, null, null, new File(args[0]), builder);
}

代码示例来源:origin: org.codehaus.groovy/groovy-ant

public static void main(String[] args) {
  final GroovyShell shell = new GroovyShell(new Binding());
  final Groovy groovy = new Groovy();
  for (int i = 1; i < args.length; i++) {
    final Commandline.Argument argument = groovy.createArg();
    argument.setValue(args[i]);
  }
  final AntBuilder builder = new AntBuilder();
  groovy.setProject(builder.getProject());
  groovy.parseAndRunScript(shell, null, null, null, new File(args[0]), builder);
}

代码示例来源:origin: org.kohsuke.droovy/groovy

public static void main(String[] args) {
  final GroovyShell shell = new GroovyShell(new Binding());
  final Groovy groovy = new Groovy();
  for (int i = 1; i < args.length; i++) {
    final Commandline.Argument argument = groovy.createArg();
    argument.setValue(args[i]);
  }
  final AntBuilder builder = new AntBuilder();
  groovy.setProject(builder.getProject());
  groovy.parseAndRunScript(shell, null, null, null, new File(args[0]), builder);
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

private Target onStartTarget(final Attributes attrs, String tagName, String ns) {
  final Target target = new Target();
  target.setProject(project);
  target.setLocation(new Location(antXmlContext.getLocator()));
  try {
    antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
    final Target newTarget = (Target) getProject().getTargets().get(attrs.getValue("name"));
    // execute dependencies (if any)
    final Vector targets = new Vector();
    for (final Enumeration deps=newTarget.getDependencies(); deps.hasMoreElements();)
    {
      final String targetName = (String) deps.nextElement();
      targets.add(project.getTargets().get(targetName));
    }
    getProject().executeSortedTargets(targets);
    
    antXmlContext.setCurrentTarget(newTarget);
    return newTarget;
  } 
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  return null;
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

private Target onStartTarget(final Attributes attrs, String tagName, String ns) {
  final Target target = new Target();
  target.setProject(project);
  target.setLocation(new Location(antXmlContext.getLocator()));
  try {
    antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
    final Target newTarget = (Target) getProject().getTargets().get(attrs.getValue("name"));
    // execute dependencies (if any)
    final Vector targets = new Vector();
    for (final Enumeration deps = newTarget.getDependencies(); deps.hasMoreElements();) {
      final String targetName = (String) deps.nextElement();
      targets.add(project.getTargets().get(targetName));
    }
    getProject().executeSortedTargets(targets);
    antXmlContext.setCurrentTarget(newTarget);
    return newTarget;
  }
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  return null;
}

代码示例来源:origin: org.codehaus.groovy/groovy-ant

private Target onStartTarget(final Attributes attrs, String tagName, String ns) {
  final Target target = new Target();
  target.setProject(project);
  target.setLocation(new Location(antXmlContext.getLocator()));
  try {
    antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
    final Target newTarget = getProject().getTargets().get(attrs.getValue("name"));
    // execute dependencies (if any)
    final Vector<Target> targets = new Vector<Target>();
    for (final Enumeration<String> deps = newTarget.getDependencies(); deps.hasMoreElements();) {
      final String targetName = deps.nextElement();
      targets.add(project.getTargets().get(targetName));
    }
    getProject().executeSortedTargets(targets);
    antXmlContext.setCurrentTarget(newTarget);
    return newTarget;
  }
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  return null;
}

代码示例来源:origin: org.kohsuke.droovy/groovy

private Target onStartTarget(final Attributes attrs, String tagName, String ns) {
  final Target target = new Target();
  target.setProject(project);
  target.setLocation(new Location(antXmlContext.getLocator()));
  try {
    antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
    final Target newTarget = (Target) getProject().getTargets().get(attrs.getValue("name"));
    // execute dependencies (if any)
    final Vector targets = new Vector();
    for (final Enumeration deps=newTarget.getDependencies(); deps.hasMoreElements();)
    {
      final String targetName = (String) deps.nextElement();
      targets.add(project.getTargets().get(targetName));
    }
    getProject().executeSortedTargets(targets);
    
    antXmlContext.setCurrentTarget(newTarget);
    return newTarget;
  } 
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  return null;
}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

private Target onStartTarget(final Attributes attrs, String tagName, String ns) {
  final Target target = new Target();
  target.setProject(project);
  target.setLocation(new Location(antXmlContext.getLocator()));
  try {
    antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
    final Target newTarget = (Target) getProject().getTargets().get(attrs.getValue("name"));
    // execute dependencies (if any)
    final Vector targets = new Vector();
    for (final Enumeration deps=newTarget.getDependencies(); deps.hasMoreElements();)
    {
      final String targetName = (String) deps.nextElement();
      targets.add(project.getTargets().get(targetName));
    }
    getProject().executeSortedTargets(targets);
    
    antXmlContext.setCurrentTarget(newTarget);
    return newTarget;
  } 
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  return null;
}

代码示例来源:origin: org.codehaus.groovy/groovy-ant

private Target onDefineTarget(final Attributes attrs, String tagName, String ns) {
  final Target target = new Target();
  target.setProject(project);
  target.setLocation(new Location(antXmlContext.getLocator()));
  try {
    antTargetHandler.onStartElement(ns, tagName, tagName, attrs, antXmlContext);
    final Target newTarget = getProject().getTargets().get(attrs.getValue("name"));
    antXmlContext.setCurrentTarget(newTarget);
    definingTarget = newTarget;
    return newTarget;
  }
  catch (final SAXParseException e) {
    log.log(Level.SEVERE, "Caught: " + e, e);
  }
  return null;
}

相关文章