boolean (final DataContext dataContext, final AntBuildTarget target, final List<BuildFileProperty> additionalProperties) { final Semaphore targetDone = new Semaphore(); targetDone.down(); final Ref<Boolean> result = Ref.create(Boolean.FALSE); ApplicationManager.getApplication().invokeLater(() -> { try { final Project project = dataContext.getData(CommonDataKeys.PROJECT); if (project == null || project.isDisposed()) { targetDone.up(); } else { target.run(dataContext, additionalProperties, new AntBuildListener() { @Override public void buildFinished(int state, int errorCount) { result.set((state == AntBuildListener.FINISHED_SUCCESSFULLY) && (errorCount == 0)); targetDone.up(); } }); } } catch (Throwable e) { targetDone.up(); LOG.error(e); } }); targetDone.waitFor(); return result.get(); }