public async open()

in src/exportJarSteps/ExportJarTaskProvider.ts [196:242]


    public async open(_initialDimensions: TerminalDimensions | undefined): Promise<void> {
        activeTerminalMap.set(this.terminalId, this);
        revealTerminal(this.stepMetadata.taskLabel);
        let exportResult: boolean | undefined;
        try {
            if (!this.stepMetadata.workspaceFolder) {
                throw new Error(ExportJarMessages.fieldUndefinedMessage(ExportJarMessages.Field.WORKSPACEFOLDER, ExportJarStep.ResolveTask));
            }
            if (this.stepMetadata.outputPath === undefined) {
                // TODO: get resolved path from setting configuration.java.project.exportJar.targetPath.
                // For the tasks whose targetPath is undefined, the user will select the output location manually.
                this.stepMetadata.outputPath = "";
            }
            if (!_.isEmpty(this.stepMetadata.elements)) {
                const outputFolderMap: Map<string, string[]> = new Map<string, string[]>();
                const artifactMap: Map<string, string[]> = new Map<string, string[]>();
                const testOutputFolderMap: Map<string, string[]> = new Map<string, string[]>();
                const testArtifactMap: Map<string, string[]> = new Map<string, string[]>();
                const projectList: INodeData[] = await Jdtls.getProjects(this.stepMetadata.workspaceFolder.uri.toString());
                for (const project of projectList) {
                    await this.setClasspathMap(project, "runtime", outputFolderMap, artifactMap);
                    await this.setClasspathMap(project, "test", testOutputFolderMap, testArtifactMap);
                }
                this.stepMetadata.classpaths = await this.resolveClasspaths(outputFolderMap,
                    artifactMap, testOutputFolderMap, testArtifactMap);
            }
            exportResult = await this.createJarFile(this.stepMetadata);
        } catch (err) {
            if (err) {
                failMessage(`${err}`);
                this.exit("[ERROR] An error occurs during export Jar process");
            } else {
                this.exit("[CANCEL] Export Jar process is cancelled by user");
            }
        } finally {
            isExportingJar = false;
            if (exportResult === true) {
                successMessage(this.stepMetadata.outputPath);
                this.exit("[SUCCESS] Export Jar process is finished successfully");
            } else if (exportResult === false) {
                // We call `executeExportJarTask()` with the same entry here
                // to help the user reselect the Java project.
                executeExportJarTask(this.stepMetadata.entry);
            }
            this.exit();
        }
    }