doomemacs/modules/lang/java
Henrik Lissner 9ef5ca2922 bump: :lang
Andersbakken/rtags@65113e2a13 -> Andersbakken/rtags@cdff9b47fc
Emacs-Kotlin-Mode-Maintainers/kotlin-mode@0e4bafb31d -> Emacs-Kotlin-Mode-Maintainers/kotlin-mode@876cc27dc1
Groovy-Emacs-Modes/groovy-emacs-modes@99eaf70720 -> Groovy-Emacs-Modes/groovy-emacs-modes@84f89b68ec
JuliaEditorSupport/julia-emacs@fe6f6f7a80 -> JuliaEditorSupport/julia-emacs@06f6fdb94c
NixOS/nix-mode@3cca5b6527 -> NixOS/nix-mode@8e20de5ba7
OVYA/php-cs-fixer@c5b5d8a498 -> OVYA/php-cs-fixer@cc9a3624dc
ProofGeneral/PG@bc86736abb -> ProofGeneral/PG@e2b4227e1f
Raku/raku-mode@7496ad3a03 -> Raku/raku-mode@eaac071f17
Somelauw/evil-markdown@064fe9b476 -> Somelauw/evil-markdown@8e6cc68af8
StanfordLegion/terra-mode@eab9e59ded -> StanfordLegion/terra-mode@ceef8cae5b
amake/flutter.el@960b63576a -> amake/flutter.el@81c524a43c
ananthakumaran/tide@ccff099e94 -> ananthakumaran/tide@296c0e0e3a
asok/projectile-rails@6a18ada356 -> asok/projectile-rails@30828afbfa
beancount/beancount-mode@02fe03ee44 -> beancount/beancount-mode@dbafe6a73d
bradyt/dart-mode@43975c9208 -> bradyt/dart-mode@3bac14200f
brianc/jade-mode@4dbde92542 -> brianc/jade-mode@111460b056
brotzeit/rustic@6ca73bb3cc -> brotzeit/rustic@804ebfe029
cdominik/cdlatex@614a8d94f6 -> cdominik/cdlatex@f215b70c5c
clojure-emacs/clojure-mode@3e426b3a47 -> clojure-emacs/clojure-mode@e1dc7caee7
cython/cython@fae33cf7d4 -> cython/cython@aea4e6b84b
dgutov/robe@e1304d123d -> dgutov/robe@fd972e912d
emacs-csharp/csharp-mode@093f0f21a9 -> emacs-csharp/csharp-mode@fe8a68e984
emacs-ess/ESS@4fefd0feaa -> emacs-ess/ESS@a7ce81bb76
emacs-geiser/gauche@66e51430bd -> emacs-geiser/gauche@fd52cbaed9
emacs-geiser/geiser@4099dce8f5 -> emacs-geiser/geiser@327ff01e5b
emacs-lsp/lsp-metals@ca927e5a83 -> emacs-lsp/lsp-metals@695291761b
emacs-php/php-mode@cbf2723264 -> emacs-php/php-mode@535aec8173
emacs-straight/auctex@ea410dce4f -> emacs-straight/auctex@3b0a080ae5
emacs-typescript/typescript.el@1043025d42 -> emacs-typescript/typescript.el@2a58631230
erlang/otp@645ea8110d -> erlang/otp@118cb37bd5
ethereum/emacs-solidity@5f6ef3156f -> ethereum/emacs-solidity@6f7bd1641e
factor/factor@b989a860d1 -> factor/factor@7b451bb813
fsharp/emacs-fsharp-mode@93b1fbc31d -> fsharp/emacs-fsharp-mode@c90d762c06
fxbois/web-mode@8ef47935d6 -> fxbois/web-mode@61f057a6ba
greghendershott/racket-mode@7f12cb1ff2 -> greghendershott/racket-mode@a879a8d67b
haskell/haskell-mode@98ba392236 -> haskell/haskell-mode@8402caa341
hhvm/hack-mode@f9315be699 -> hhvm/hack-mode@4c1c2b0939
idris-hackers/idris-mode@f52ad0b477 -> idris-hackers/idris-mode@3cc9361b4c
immerrr/lua-mode@2bd9077dd0 -> immerrr/lua-mode@5a9bee8d5f
iyefrat/evil-tex@87445d4d23 -> iyefrat/evil-tex@aa0ddf8e76
jimhourihan/glsl-mode@b071120164 -> jimhourihan/glsl-mode@9b2e5f28e4
joaotavora/sly@41f4d65048 -> joaotavora/sly@540a8c5b9a
jrblevin/markdown-mode@359347b2bb -> jrblevin/markdown-mode@862ae8addd
jwiegley/emacs-async@9a8cd0c3d5 -> jwiegley/emacs-async@5d365ffc6a
liblit/demangle-mode@aaef0bd77a -> liblit/demangle-mode@04f545adab
necaris/conda.el@6db0720b6d -> necaris/conda.el@4de6eccda5
ocaml-ppx/ocamlformat@5dd6574d8f -> ocaml-ppx/ocamlformat@22a3707da3
ocaml/dune@75ecfe3421 -> ocaml/dune@4d0a47edd5
ocaml/merlin@5731826810 -> ocaml/merlin@e4791e2298
ocaml/merlin@5731826810 -> ocaml/merlin@e4791e2298
ocaml/tuareg@b59c422759 -> ocaml/tuareg@00faf47a7c
pashky/restclient.el@2cc1fd3496 -> pashky/restclient.el@176d9cb655
polymode/polymode@7d1f822f08 -> polymode/polymode@54888d6c15
s-kostyaev/go-gen-test@44c202ac97 -> s-kostyaev/go-gen-test@35df36dcd5
seagle0128/grip-mode@c0ca789903 -> seagle0128/grip-mode@1c82e27bee
smihica/emmet-mode@1acb821e01 -> smihica/emmet-mode@6b2e554f7f
swift-emacs/swift-mode@1b47a09f1c -> swift-emacs/swift-mode@800efe2910
technomancy/fennel-mode@a908db8696 -> technomancy/fennel-mode@47152970a9
vspinu/company-math@a796053590 -> vspinu/company-math@45778f5731
yoshiki/yaml-mode@3a57058468 -> yoshiki/yaml-mode@63b637f846
ziglang/zig-mode@0babe7ec52 -> ziglang/zig-mode@aba01b6199
2021-09-15 01:22:33 +02:00
..
autoload Rename Groovy REPL command 2021-04-16 23:22:30 +07:00
+eclim.el Refactor localleader keybinds #1270 2019-10-04 22:04:47 -04:00
+lsp.el Don't load lsp-java/dap-java if +eglot 2020-10-14 01:40:11 -04:00
+meghanada.el refactor: rename orig-fn arg in advice to fn 2021-08-04 01:53:12 -04:00
config.el Rename Groovy REPL command 2021-04-16 23:22:30 +07:00
doctor.el Only check when formatting feature is enabled. 2020-10-06 17:38:10 +02:00
packages.el bump: :lang 2021-09-15 01:22:33 +02:00
README.org Configure java +lsp test runner via dap-mode (#3049) 2020-05-08 05:54:54 -04:00

lang/java

Description

This module adds java support to Doom Emacs, including android-mode and groovy-mode.

Module Flags

  • +lsp Enables integration for the eclipse.jdt.ls LSP server.
  • +meghanada Enables the meghanada-mode

The +lsp and +meghanada packages are mutually exclusive and do not work together. At the time of writing the +meghanada is already configured whereas +lsp needs to manual configuring.

The lsp test runner requires that :tools (debugger +lsp) is enabled, as this provides dap-mode which contains the Java test runner.

Prerequisites

This module requires the Java SDK.

OpenJDK 11

Ubuntu

sudo apt-get install openjdk-11-jdk-headless

Fedora

sudo dnf install java-11-openjdk

Oracle JDK 11

Ubuntu

sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java11-installer
sudo apt install oracle-java11-set-default

Fedora

curl -O https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz
tar zxvf openjdk-11.0.2_linux-x64_bin.tar.gz
sudo mv jdk-11.0.2/ /usr/local/

Open /etc/profile.d/jdk11.sh as root and add

export JAVA_HOME=/usr/local/jdk-11.0.2
export PATH=$PATH:$JAVA_HOME/bin

Save the file and source the file

source /etc/profile.d/jdk11.sh
java -version

Multiple Java Versions

It is common to need support for multiple Java versions. You can use a generic tool like jabba to install and manage multiple Java versions on any OS.

To switch between Java versions in Doom, you can use direnv and the direnv module. To set a Java version for a particular project, create a .envrc pointing to the Java installation in the root of the project:

PATH_add ~/.jabba/jdk/adopt@1.11.0-3
JAVA_HOME=~/.jabba/jdk/adopt@1.11.0-3

And then run direnv allow . in the project directory. If the direnv module is enabled, then Doom will automatically source this environment before executing the LSP server.

Features

+lsp features

According to https://github.com/emacs-lsp/lsp-java it adds

  • As you type reporting of parsing and compilation errors (via flycheck/lsp-ui)
  • Code completion - using company-lsp or builtin complete-at-point
  • Javadoc hovers - using lsp-ui
  • Code actions - using lsp-ui
  • Code outline - using builtin imenu
  • Code navigation - using builtin xref
  • Code lens (references/implementations) - using builtin xref
  • Highlights
  • Code formatting
  • Maven pom.xml project support
  • Limited Gradle support
  • Visual debugger - dap-mode
  • Test runner - dap-mode
  • Project explorer integration - treemacs
  • Integration with Spring Initializr

+meghanada features

According to https://github.com/mopemope/meghanada-emacs/ it adds

  • Auto-update server module
  • Gradle and Maven and Eclipse project support
  • No need build tool's plugin
  • Run build tool task
  • Compile your project
  • Syntax check and analyze java source (flycheck-meghanada)
  • Support Generic Types
  • Code completion with company-mode (company-meghanada)
  • Optimize import and sort
  • Jump declaration
  • Run JUnit test (include test runner)
  • Diagnostic reporting with flycheck (flycheck-meghanada)
  • Show symbol's type info with el-doc
  • Search references
  • Full-featured text search

Configuration

+lsp

Install the eclipse server by executing M-x lsp-install-server and selecting jdtls. After that any newly opened java files should start the LSP server automatically.

To update the server, perform SPC u M-x lsp-install-server.

Note that if you change Java version you may need to remove the LSP server and install it again. You can do this with M-x +lsp/uninstall-server followed by M-x lsp-install-server.

Enable the :tools (debugger +lsp) module to get test runner support.