首页 > 解决方案 > 将 spacemacs 配置为 java (spring) ide

问题描述

我是使用 spacemacs 的初学者,但我正在努力学习。我是一名 java 开发人员,我已经将 spacemacs 配置为 java ide。我的配置层是这样的:

dotspacemacs-configuration-layers
   '(javascript
     ;; ----------------------------------------------------------------
     ;; Example of useful layers you may want to use right away.
     ;; Uncomment some layer names and press `SPC f e R' (Vim style) or
     ;; `M-m f e R' (Emacs style) to install them.
     ;; ----------------------------------------------------------------
     auto-completion
     ;; better-defaults
     emacs-lisp
     git
     helm
     lsp
     markdown
     (multiple-cursors :variables multiple-cursors-backend 'mc)
     (plantuml :variables plantuml-jar-path "~/plantuml/plantuml.jar")
     org
     (shell :variables
             shell-default-height 30
             shell-default-position 'bottom)
     ;; spell-checking
     ;; syntax-checking
     version-control
     (java :variables java-backend 'lsp)
     dap
     treemacs)

我的用户配置是这样的

(defun dotspacemacs/user-config ()
  "Configuration for user code:
This function is called at the very end of Spacemacs startup, after layer
configuration.
Put your configuration code here, except for variables that should be set
before packages are loaded."
  (setq lombok-jar-path
        (expand-file-name
         "~/lombok/lombok.jar"
         )
        )

  (setq lsp-java-vmargs `(
                          "-noverify"
                          "-Xmx1G"
                          "-XX:+UseG1GC"
                          "-XX:+UseStringDeduplication"
                          ,(concat "-javaagent:" lombok-jar-path)
                          ,(concat "-Xbootclasspath/a:" lombok-jar-path)
                          "--add-opens"
                          "java.base/java.util=ALL-UNNAMED"
                          "--add-opens"
                          "java.base/java.lang=ALL-UNNAMED"
                          "--add-modules=ALL-SYSTEM"
                          )
        )
  )

使用这个配置,我可以很好地编写我的代码,但是当我尝试使用 Mx dap-java-debug 使用 dap 来运行我的应用程序时,我收到了一个异常,一个 ClassNotFoundException 完全正确。我上传了一个关于这个的截图 错误结果

也许我需要添加一个像 vscode 这样的 launch.json 配置,但我不知道。

有人可以在 spacemacs 中运行 Spring Boot 应用程序吗?

感谢您的回答。

上:避免回答我使用像 intellij 或 eclipse 这样的 ide,因为我正在学习 emacs。

标签: javaspringspacemacs

解决方案


推荐阅读