@Override
    public Object onExecute(ExecutionEvent event) throws ExecutionException {
        project = PluginUtil.getSelectedProject();
        try {
            if (project == null) {
                throw new Exception(Constant.ERROR_NO_SELECTED_PROJECT);
            }
            basePath = project.getLocation().toString();
            if (MavenUtils.isMavenProject(project)) {
                destinationPath = MavenUtils.getTargetPath(project);
            } else {
                destinationPath = Paths.get(basePath, Constant.DOCKERFILE_FOLDER, project.getName() + ".war")
                        .normalize().toString();
            }
            // Stop running container
            String runningContainerId = DockerRuntime.getInstance().getRunningContainerId(basePath);
            if (runningContainerId != null) {
                boolean stop = MessageDialog.openConfirm(PluginUtil.getParentShell(), "Confirmation",
                        Constant.MESSAGE_CONFIRM_STOP_CONTAINER);
                if (stop) {
                    DockerRuntime.getInstance().cleanRuningContainer(basePath);
                } else {
                    return null;
                }
            }
            // Build artifact
            ConsoleLogger.info(String.format(Constant.MESSAGE_EXPORTING_PROJECT, destinationPath));
            if (MavenUtils.isMavenProject(project)) {
                MavenExecuteAction action = new MavenExecuteAction(MAVEN_GOALS);
                IContainer container;
                container = MavenUtils.getPomFile(project).getParent();
                action.launch(container, () -> {
                    // TODO: callback after mvn package done. IMPORTANT
                    buildAndRun(event);
                    return null;
                });
            } else {
                WarUtil.export(project, destinationPath);
                buildAndRun(event);
            }
        } catch (Exception e) {
            e.printStackTrace();
            ConsoleLogger.error(String.format(Constant.ERROR_RUNNING_DOCKER, e.getMessage()));
            sendTelemetryOnException(event, e);
        }
        return null;
    }
@Override
    public Object onExecute(ExecutionEvent event) throws ExecutionException {
        project = PluginUtil.getSelectedProject();
        try {
            if (project == null) {
                throw new Exception(Constant.ERROR_NO_SELECTED_PROJECT);
            }
            basePath = project.getLocation().toString();
            if (MavenUtils.isMavenProject(project)) {
                destinationPath = MavenUtils.getTargetPath(project);
            } else {
                destinationPath = Paths.get(basePath, Constant.DOCKERFILE_FOLDER, project.getName() + ".war")
                        .normalize().toString();
            }
           
            String runningContainerId = DockerRuntime.getInstance().getRunningContainerId(basePath);
            if (runningContainerId != null) {
                boolean stop = MessageDialog.openConfirm(PluginUtil.getParentShell(), "Confirmation",
                        Constant.MESSAGE_CONFIRM_STOP_CONTAINER);
                if (stop) {
                    DockerRuntime.getInstance().cleanRuningContainer(basePath);
                } else {
                    return null;
                }
            }
           
            ConsoleLogger.info(String.format(Constant.MESSAGE_EXPORTING_PROJECT, destinationPath));
            if (MavenUtils.isMavenProject(project)) {
                MavenExecuteAction action = new MavenExecuteAction(MAVEN_GOALS);
                IContainer container;
                container = MavenUtils.getPomFile(project).getParent();
                action.launch(container, () -> {
                   
                    buildAndRun(event);
                    return null;
                });
            } else {
                WarUtil.export(project, destinationPath);
                buildAndRun(event);
            }
        } catch (Exception e) {
            e.printStackTrace();
            ConsoleLogger.error(String.format(Constant.ERROR_RUNNING_DOCKER, e.getMessage()));
            sendTelemetryOnException(event, e);
        }
        return null;
    }
@override public object onexecute(executionevent event) throws executionexception { project = pluginutil.getselectedproject(); try { if (project == null) { throw new exception(constant.error_no_selected_project); } basepath = project.getlocation().tostring(); if (mavenutils.ismavenproject(project)) { destinationpath = mavenutils.gettargetpath(project); } else { destinationpath = paths.get(basepath, constant.dockerfile_folder, project.getname() + ".war") .normalize().tostring(); } string runningcontainerid = dockerruntime.getinstance().getrunningcontainerid(basepath); if (runningcontainerid != null) { boolean stop = messagedialog.openconfirm(pluginutil.getparentshell(), "confirmation", constant.message_confirm_stop_container); if (stop) { dockerruntime.getinstance().cleanruningcontainer(basepath); } else { return null; } } consolelogger.info(string.format(constant.message_exporting_project, destinationpath)); if (mavenutils.ismavenproject(project)) { mavenexecuteaction action = new mavenexecuteaction(maven_goals); icontainer container; container = mavenutils.getpomfile(project).getparent(); action.launch(container, () -> { buildandrun(event); return null; }); } else { warutil.export(project, destinationpath); buildandrun(event); } } catch (exception e) { e.printstacktrace(); consolelogger.error(string.format(constant.error_running_docker, e.getmessage())); sendtelemetryonexception(event, e); } return null; }