@@ -46,7 +46,7 @@ The slash is expected at the end."
46
46
:risky t
47
47
:type 'directory )
48
48
49
- (defcustom lsp-java-jdt-download-url " http ://download.eclipse.org/jdtls/snapshots/jdt-language-server-latest.tar.gz"
49
+ (defcustom lsp-java-jdt-download-url " https ://download.eclipse.org/jdtls/snapshots/jdt-language-server-latest.tar.gz"
50
50
" JDT JS download url.
51
51
Use http://download.eclipse.org/che/che-ls-jdt/snapshots/che-jdt-language-server-latest.tar.gz if you want to use Eclipse Che JDT LS."
52
52
:group 'lsp-java
@@ -563,28 +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
- (shell-command 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 )))
588
587
589
588
(defun lsp-java-update-server ()
590
589
" Update LDT LS server."
0 commit comments