private void _configureRootTaskDistBundle(final Task warTask) {
    Project project = warTask.getProject();

    Copy copy =
        (Copy)
            GradleUtil.getTask(
                project.getRootProject(), RootProjectConfigurator.DIST_BUNDLE_TASK_NAME);

    copy.dependsOn(warTask);

    copy.into(
        "osgi/modules",
        new Closure<Void>(project) {

          @SuppressWarnings("unused")
          public void doCall(CopySpec copySpec) {
            Project project = warTask.getProject();

            ConfigurableFileTree configurableFileTree = project.fileTree("dist");

            configurableFileTree.builtBy(warTask);
            configurableFileTree.include("*.war");

            copySpec.from(configurableFileTree);
          }
        });
  }
  private UpdatePropertiesTask _addTaskUpdateProperties(
      Project project, final WorkspaceExtension workspaceExtension) {

    UpdatePropertiesTask updatePropertiesTask =
        GradleUtil.addTask(project, UPDATE_PROPERTIES_TASK_NAME, UpdatePropertiesTask.class);

    updatePropertiesTask.property(
        "app.server.parent.dir",
        new Callable<String>() {

          @Override
          public String call() throws Exception {
            return FileUtil.getAbsolutePath(workspaceExtension.getHomeDir());
          }
        });

    updatePropertiesTask.setDescription(
        "Updates the Plugins SDK build properties with the workspace " + "configuration.");

    String userName = System.getProperty("user.name");

    updatePropertiesTask.setPropertiesFile("build." + userName + ".properties");

    return updatePropertiesTask;
  }
  @Override
  public void apply(Project project) {
    WorkspaceExtension workspaceExtension =
        GradleUtil.getExtension((ExtensionAware) project.getGradle(), WorkspaceExtension.class);

    Task initBundleTask =
        GradleUtil.getTask(project.getRootProject(), RootProjectConfigurator.INIT_BUNDLE_TASK_NAME);

    _configureAnt(project);

    UpdatePropertiesTask updatePropertiesTask =
        _addTaskUpdateProperties(project, workspaceExtension);

    _addTaskBuild(project, updatePropertiesTask);

    Task warTask = GradleUtil.getTask(project, WarPlugin.WAR_TASK_NAME);

    _configureTaskWar(warTask, workspaceExtension, initBundleTask);

    _configureRootTaskDistBundle(warTask);
  }