Emacs Java Malabar Mode

1.1k views Asked by At

I was using JDEE for my java projects in Emacs. JDEE does not work well for maven. Recently I came across Malabar Mode which has better support for Maven based Java projects in Emacs.

I managed to install malbar-mode using melpa in M-x list-packages. But when I'm getting error message on mvn package for my simple app https://github.com/vijayendra/JavaSrc/tree/master/my-app

Projects.get('/home/egnyte/src/my-app/pom.xml', []).run(['package'], [], [:])
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building my-app Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.081s
[INFO] Finished at: Sat Dec 06 23:55:22 PST 2014
[INFO] Final Memory: 20M/48M
[INFO] ------------------------------------------------------------------------
[ERROR] Execution error
org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for or\
g.apache.maven.plugins:maven-resources-plugin:jar:2.5
        at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:129)
        at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:142)
        at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:261)
        at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185)

My emacs version is as follows:

emacs -version
GNU Emacs 24.3.1
Copyright (C) 2013 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

My .emacs file is as follows:

(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa-stable" . "http://stable.melpa.org/packages/") t)
;; unstable packages
;; (add-to-list 'package-archives
;;              '("melpa" . "http://melpa.org/packages/") t)
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line

(require 'cedet)
(require 'semantic)
(load "semantic/loaddefs.el")
(semantic-mode 1)
(setq malabar-groovy-lib-dir "~/.m2/repository/com/software-ninja/malabar/1.5.10")
(require 'malabar-mode)
(add-to-list 'auto-mode-alist '("\\.java\\'" . malabar-mode))       

My maven version is as follows:

mvn -version
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T13:58:10-07:00)
Maven home: /home/egnyte/lib/apache-maven-3.2.3
Java version: 1.7.0_65, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.8.0-29-generic", arch: "amd64", family: "unix"

How can I get malabar mode to work?

1

There are 1 answers

2
M Smith On

There are two answers.

First, malabar-mode is stuck at maven 3.0.4 so try that version. Also do not set the lib dir. It should be set automatically.

Second, in order to get around the maven version I am rewriting malabar-mode from scratch. Follow the instructions at https://github.com/m0smith/malabar-mode/blob/develop/doc/2.0/INSTALL.md. This version should work for all versions of maven after 3.0.4. It is a work in progress and not all the features are there yet.
If you have problems or suggestions create an issue in the GitHub repo as now is a good time to get your wishes known

EDIT: 2.0 of malabar has been released to MELPA. To install now:

```

(load-file "~/projects/cedet/cedet-devel-load.el")
(add-hook 'after-init-hook (lambda ()
             (message "activate-malabar-mode")
             (activate-malabar-mode)))

(add-hook 'malabar-java-mode-hook 'flycheck-mode)
(add-hook 'malabar-groovy-mode-hook 'flycheck-mode)

```