@@ -563,29 +563,27 @@ PARAMS progress report notification data."
563
563
564
564
(defun lsp-java--ensure-server ()
565
565
" Ensure that JDT server and the other configuration."
566
- (let* ((default-directory (concat temporary-file-directory " lsp-java-install/" )))
567
- (when (file-directory-p default-directory)
568
- (delete-directory default-directory t ))
569
- (when (file-directory-p lsp-java-server-install-dir)
570
- (delete-directory lsp-java-server-install-dir t ))
571
- (mkdir default-directory t )
572
- (url-copy-file (concat lsp-java--download-root " pom.xml" ) " pom.xml" t )
573
- (let ((full-command (format
574
- " %s -Djdt.js.server.root=%s -Djunit.runner.root=%s -Djunit.runner.fileName=%s -Djava.debug.root=%s clean package -Djdt.download.url=%s"
575
- (or (executable-find " mvn" ) (lsp-java--prepare-mvnw))
576
- (expand-file-name lsp-java-server-install-dir)
577
- (expand-file-name
578
- (if (boundp 'dap-java-test-runner )
579
- (file-name-directory dap-java-test-runner)
580
- (concat (file-name-directory lsp-java-server-install-dir) " test-runner" )))
581
- (if (boundp 'dap-java-test-runner )
582
- (file-name-nondirectory (directory-file-name dap-java-test-runner))
583
- " junit-platform-console-standalone.jar" )
584
- (expand-file-name (lsp-java--bundles-dir))
585
- lsp-java-jdt-download-url)))
586
- (message " Running %s " full-command)
587
- (unless (zerop (shell-command full-command))
588
- (user-error " Failed to install lsp server using '%s'" full-command)))))
566
+ (let* ((default-directory (make-temp-file " lsp-java-install" t )))
567
+ (unwind-protect
568
+ (progn
569
+ (url-copy-file (concat lsp-java--download-root " pom.xml" ) " pom.xml" t )
570
+ (let ((full-command (format
571
+ " %s -Djdt.js.server.root=%s -Djunit.runner.root=%s -Djunit.runner.fileName=%s -Djava.debug.root=%s clean package -Djdt.download.url=%s"
572
+ (or (executable-find " mvn" ) (lsp-java--prepare-mvnw))
573
+ (expand-file-name lsp-java-server-install-dir)
574
+ (expand-file-name
575
+ (if (boundp 'dap-java-test-runner )
576
+ (file-name-directory dap-java-test-runner)
577
+ (concat (file-name-directory lsp-java-server-install-dir) " test-runner" )))
578
+ (if (boundp 'dap-java-test-runner )
579
+ (file-name-nondirectory (directory-file-name dap-java-test-runner))
580
+ " junit-platform-console-standalone.jar" )
581
+ (expand-file-name (lsp-java--bundles-dir))
582
+ lsp-java-jdt-download-url)))
583
+ (message " Running %s " full-command)
584
+ (unless (zerop (shell-command full-command))
585
+ (user-error " Failed to install lsp server using '%s'" full-command)))))
586
+ (delete-directory default-directory t )))
589
587
590
588
(defun lsp-java-update-server ()
591
589
" Update LDT LS server."
0 commit comments