This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
spacemacs/layers/+lang/java
syl20bnr 74fdbb6795 Refactor and simplify company backends declaration
Enabling a company backend for a specific mode was a tedious tasks with code
scattered at different locations, one for local variable definitions, one for
company hook function definitions and another where the backends were pushed to
the local variables (which was problematic, since we ended up pushing the same
backends over and over again with `SPC f e R`, pushes have been replaced by
add-to-list calls in the new macro).

All these steps are now put together at one place with the new macro
spacemacs|add-company-backends, check its docstring for more info on its
arguments.

This macro also allows to define arbitrary buffer local variables to tune
company for specific modes (similar to layer variables via a keyword :variables)

The code related to company backends management has been moved to the
auto-completion layer in the funcs.el file. A nice side effect of this move is
that it enforces correct encapsulation of company backends related code. We can
now easily detect if there is some configuration leakage when the
auto-completion layer is not used. But we loose macro expansion at file loading
time (not sue it is a big concern though).

The function spacemacs|enable-auto-complete was never used so it has been
deleted which led to the deletion of the now empty file core-auto-completion.el.

The example in LAYERS.org regarding auto-completion is now out of date and has
been deleted. An example to setup auto-completion is provided in the README.org
file of the auto-completion layer.
2017-01-02 00:39:04 -05:00
..
img Use + instead of ! for layer categories 2015-09-11 00:13:51 -04:00
config.el Refactor and simplify company backends declaration 2017-01-02 00:39:04 -05:00
funcs.el Clean copyrights and update for year 2016 2016-01-11 21:42:17 -05:00
packages.el Refactor and simplify company backends declaration 2017-01-02 00:39:04 -05:00
README.org Fix eclim documentation in Java layer 2016-10-23 19:44:35 +02:00

Java layer

/TakeV/spacemacs/media/commit/a1fcb138033e5b9f01571dd0a4f6b8422f7bea21/layers/+lang/java/img/java.png

Description

This layer adds support for the Java language using the Eclim client/server.

Layer Installation

Layer

To use this configuration layer, add it to your ~/.spacemacs. You will need to add java to the existing dotspacemacs-configuration-layers list in this file.

Eclim

Eclim provides the ability to access Eclipse features such as code completion, searching, code validation, and many more.

Installation

For installation check the official page.

Then set the Eclipse and Eclim paths in dotspacemacs/user-config, for instance:

  (setq eclim-eclipse-dirs '("~/opt/eclipse")
        eclim-executable "~/opt/eclipse/eclim")

You can also configure other options, as shown below:

  (setq
   ;; Use another eclimd executable
   eclimd-executable "/path/to/another/executable"
   ;; Specify the workspace to use by default
   eclimd-default-workspace "/path/to/default/eclipse/workspace"
   ;; Whether or not to block emacs until eclimd is ready
   eclimd-wait-for-process t)

Usage

Start the eclim daemon with SPC m d s and stop it with SPC m d k. (See below.)

Key bindings

Java-mode

Project management

Key Binding Description
SPC m p b Build project
SPC m p c Create project
SPC m p d Delete project
SPC m p g Open file in current project
SPC m p i Import project
SPC m p j Information about project
SPC m p k Close project
SPC m p o Open project
SPC m p p Open project management buffer
SPC m p u Update project

Eclimd

Key Binding Description
SPC m d s Start daemon
SPC m d k Stop daemon

Maven

Key Binding Description
SPC m m i Run maven clean install
SPC m m I Run maven install
SPC m m p Run one already goal from list
SPC m m r Run maven goals
SPC m m R Run one maven goal
SPC m m t Run maven test

Goto

Key Binding Description
M-, jump back from go to declaration/definition
SPC m g g go to declaration
SPC m g t go to type definition

Refactoring

Key Binding Description
SPC m r i optimize imports
SPC m r f Format file
SPC m r r Rename symbol

Documentation, Find

Key Binding Description
SPC m f f general find in project
SPC m h h show documentation for symbol at point
SPC m h u show usages for symbol at point

Problems

Key Binding Description
SPC m e a set all problems for next/prev action
SPC m e b open buffer with problems
SPC m e c show options with problem corrections
SPC m e e set only errors for next/prev action
SPC m e f set only current file for next/prev action
SPC m e n go to next problem
SPC m e o open buffer with problems
SPC m e p go to previous problem
SPC m e w set warnings for next/prev action

Tests

Key Binding Description
SPC m t t run JUnit tests for current method or current file or project

Problems buffer

Key Binding Description
RET go to problem place
a show all problems
e show only errors
f show problems only for current file
g refresh problems
q quit
w show only warnings

Projects buffer

Key Binding Description
RET go to current project
c go to problem place
D delete project
g refresh buffer
i info about current project
I import existing project into the workspace
m mark current project
M mark all projects
N create new project
o open project
p update project
q quit
R rename current project
u unmark current project
U unmark all projects