Friday, October 7, 2011

Emacs and J2EE on OSX notes

Here's how I've managed to setup Emacs for J2EE / Tomcat / Maven application development on OSX. 

Install Emacs

I use Emacs 23.3 from Emacs for OSX.


Malabar mode

Malabar mode offers easy code navigation, Maven, JUnit and Groovy integration. Download release 1.4 and extract in a directory to build it.

As the build will invoke emacs in batch mode, be sure that Emacs 23.3 is in your path (instead of using the one packaged with OSX).

What works on my machine:
unzip espenhw-malabar-mode-malabar-1.4.0-0-g35e1e5e.zip
cd espenhw-malabar-mode-1daaee4
export PATH=/Applications/Emacs.app/Contents/MacOS:$PATH
mvn package -DskipTests=true
Now in target directory there's a malabar-1.4.0-dist.zip. Unzip it where you put all your emacs librairies:

cd ~/.emacs.d/
unzip /path/to/malabar/target/malabar-1.4.0-dist.zip


Configure Emacs for Malabar

Open your .emacs and add:
(add-to-list 'load-path (expand-file-name "~/.emacs.d/malabar-1.4.0/lisp/")) 

(require 'cedet)
(require 'malabar-mode)
(setq malabar-groovy-lib-dir "/path/to/malabar/lib")
(add-to-list 'auto-mode-alist '("\\.java\\'" . malabar-mode))

(semantic-mode 1)
(require 'malabar-mode)
(setq malabar-groovy-lib-dir "~/.emacs.d/malabar-1.4.0/lib"
      malabar-load-source-from-sibling-projects t
      malabar-extra-source-locations
      '( "/absolute/path/to/project1/src" 
        "/absolute/path/to/project2/src" ) ) ;; you need to setup this 

(add-to-list 'auto-mode-alist '("\\.java\\'" . malabar-mode))

(add-hook 'malabar-mode-hook
     (lambda () 
       (add-hook 'after-save-hook 'malabar-compile-file-silently
                  nil t)))

Now open a .java file within Emacs.

Try malabar-jump-to-thing on one of your class and it should open the corresponding file.

Open a test file and try malabar-run-test. It should run maven test for this file. If all tests OK but finished with "BUILD FAILURE", then see next section


Java troubleshooting

Malabar should use java from jdk, not jde. I've tried setting JAVA_HOME and configure malabar without success. So quick dirty hack is:

cd /usr/bin
mv java java.jre
ln -s  /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java

Ressources

Entreprise Java Development With Emacs

Debugging Tomcat

Install JDIBug. In jdibug-expr.el, change the line (and to forget to byte-recompile or remove .elc):
(require 'semantic-java)
(require 'semantic/java)
Configure emacs:

(add-to-list 'load-path "~/.emacs.d/jdibug-0.5")
(setq jdibug-connect-hosts (quote ("localhost:8000"))
      jdibug-use-jde-source-paths nil
      jdibug-source-paths
      (list
			 "/path/to/project1/src" 
			 "/path/to/project2/src"  ))
(require 'jdibug)
Start Tomcat like with debugger enabled:
./bin/catalina.sh jpda start
Then try jdibug-connect to attach Emacs to tomcat.

Tuesday, July 12, 2011

TWM: Docking Windows

Using Pharo 1.4 and latest TWM packages, you can now group windows as tabs.

Use:
(ConfigurationOfTilingWindowManager project 
    version: #bleedingEdge) load



Tuesday, June 28, 2011

My Pharo image

Backup of my preferences:
Gofer it
   squeaksource: 'MetacelloRepository';
   package: 'ConfigurationOfPhexample';
   package: 'ConfigurationOfAutotest';
   squeaksource: 'TilingWindowManager';
   package: 'ConfigurationOfTilingWindowManager';
   load.
 
(Smalltalk at:#ConfigurationOfTilingWindowManager) perform: #loadDevelopment.
(Smalltalk at:#ConfigurationOfPhexample) load.
((Smalltalk at:#ConfigurationOfAutotest) project version: #development) load: 'OB'.

(Smalltalk at:#TWMUITheme) beCurrent. 
TaskbarMorph  showTaskbar: false.
TasklistMorph keepOpen: true.
(Smalltalk at:#TWMBar) perform: #showTWMBar: with: true.
(Smalltalk at: #AutotestDashboard) perform: #showAutotestDashboard: with: true.

Saturday, June 11, 2011

Albaaaaaator, Albaaaaaaator, capitaine au coeur d'or ......

Le papa d'Albator / Captain Harlock, Lieji Matsumoto, était à Annecy pour le festival d'animation.... on a la dédicace !!!


Nostalgie ....

Tuesday, June 7, 2011

Multiple Worlds for TWM

With the help of my local developper group, I've integrated Sean DeNigris work and now Tiling Window Manager supports Multiple Worlds.

Here's a screencast that shows the progress. (My English seems a little less catastrophic than the previous screencast :)

Note: The tests failing on the screencast (Pharo 1.2) are green on Pharo 1.3.



Load TWM with:
Gofer it
  squeaksource: 'TilingWindowManager';
  package: 'TWM';
  load.


And ConfigurationOfKeyMapping 1.7 (TWM do not work with 1.8 actually) with:
Gofer it
    squeaksource: 'ShortWays';
    package: 'ConfigurationOfKeymapping';
    load.
    
(ConfigurationOfKeymapping project version: '1.7') load.