/** Set an ant property. */
  private void setProperty(String name, String value) throws BuildException {
    Property property = new Property();

    property.setName(name);
    property.setValue(value);

    property.setProject(getProject());
    property.execute();
  }
 public void execute() throws BuildException {
   try {
     super.execute();
   } catch (final BuildException be) {
     if (failonerrorProperty == null) {
       throw be;
     }
     final org.apache.tools.ant.taskdefs.Property property =
         (org.apache.tools.ant.taskdefs.Property) getProject().createTask("property");
     property.setOwningTarget(getOwningTarget());
     property.init();
     property.setName(failonerrorProperty);
     property.setValue("true");
     property.execute();
   }
 }
示例#3
0
  public boolean execute(Project project, long contentLength, InputStream content)
      throws Throwable {
    Ant ant = (Ant) project.createTask("ant");
    File baseDir = project.getBaseDir();
    if (dir != null) baseDir = new File(dir);
    ant.setDir(baseDir);
    ant.setInheritAll(inheritall);
    ant.setInheritRefs(interitrefs);

    if (target != null) ant.setTarget(target);

    if (antFile != null) ant.setAntfile(antFile);

    Enumeration e = properties.elements();
    PropertyContainer pc = null;
    Property p = null;
    while (e.hasMoreElements()) {
      pc = (PropertyContainer) e.nextElement();
      p = ant.createProperty();
      p.setName(pc.getName());
      p.setValue(pc.getValue());
    }

    e = references.elements();
    ReferenceContainer rc = null;
    Ant.Reference ref = null;
    while (e.hasMoreElements()) {
      rc = (ReferenceContainer) e.nextElement();
      ref = new Ant.Reference();
      ref.setRefId(rc.getRefId());
      ref.setToRefid(rc.getToRefId());
      ant.addReference(ref);
    }

    ant.execute();

    return false;
  }