/**
  * Configures an element and resolves eventually given properties.
  *
  * @param  object  the element to configure
  * @param  array   the element's attributes
  * @param  object  the project this element belongs to
  * @throws Exception if arguments are not valid
  * @throws BuildException if attributes can not be configured
  * @access public
  */
 public static function configure($target, $attrs, Project $project)
 {
     if ($target instanceof TaskAdapter) {
         $target = $target->getProxy();
     }
     // if the target is an UnknownElement, this means that the tag had not been registered
     // when the enclosing element (task, target, etc.) was configured.  It is possible, however,
     // that the tag was registered (e.g. using <taskdef>) after the original configuration.
     // ... so, try to load it again:
     if ($target instanceof UnknownElement) {
         $tryTarget = $project->createTask($target->getTaskType());
         if ($tryTarget) {
             $target = $tryTarget;
         }
     }
     $bean = get_class($target);
     $ih = IntrospectionHelper::getHelper($bean);
     foreach ($attrs as $key => $value) {
         if ($key == 'id') {
             continue;
             // throw new BuildException("Id must be set Extermnally");
         }
         $value = self::replaceProperties($project, $value, $project->getProperties());
         try {
             // try to set the attribute
             $ih->setAttribute($project, $target, strtolower($key), $value);
         } catch (BuildException $be) {
             // id attribute must be set externally
             if ($key !== "id") {
                 throw $be;
             }
         }
     }
 }