Recently, I have started to do some research on PalletOps[1] for auto-provisioning Cloud Node. As a prerequisite , I must be familar with Clojure as quickly as possible because PalletOps is written using Clojure.
While creating a Clojure Development Enviroment, I found that really Counterclockwise is an excellent eclipse plugin for clojure. However, I felt that official document is still needed to be improved , especially for me and guys first using CCW.
So, I writes the following some tips based on my using experience:
[My env]
- Windows XP
- Indigo
- CCW 0.12.3.STABLE001
1 about "F3" function and finding api doc using "ctrl + mouse left key"
Often, I have seen that some people said that "F3" has not any effect and the following info happened while using "F3"
"You need a running Clojure VM"
[Resolving Way]
1) launch a repl from your clojure project in eclipse
2) require or use a concrete namespace which includes the functions or others you want to "F3"
eg. using "Programming Clojure 2nd" as an example
(ns examples.introduction)
...
; START:hello
(defn hello
"Writes hello message to *out*. Calls you by username.
Knows if you have been here before."
[username]
(swap! visitors conj username)
(str "Hello, " username))
; END:hello
...
While you want to "F3" visitors , you must input the following in a launched repl,
(require 'examples.introduction)
Then, you can use "F3" and using "ctrl + mouse left key" !
2. About Local Debug
I have seen the issue "https://groups.google.com/forum/?fromgroups#!topic/clojuredev-users/67h5zrp2k6o"
[Resolving Way]
This should be a common issue for first using CCW. The critical point is that you must generate .class file for your clojure project using
lein compile
For me, I like maven + eclipse way. So, My step is as following:
1) cd my clojure project
2) lein pom
3) mvn eclipse:eclipse
4) import my clojure project into eclipse and convert the project into clojure project
5) (Most important!!) backing to cmd shell and executing "lein compile"
6) placing breakpoint in your source
7) launch a repl in debug mode
8) imputing your expression in repl , then, switching debugging view
9) using "inspect" to observe(noting: It seems that other watch ways have not any effect)
Noting: I have found a curious problem: if you first execute "lein compile" before 5), although .class can be generated , after 4), these .class will disappear(maybe because I open auto-build in eclipse).
3. About Remote Debug
Pl. seeing : http://www.paullegato.com/blog/remote-debugging-clojure-leiningen/
However, here, I must say that there is an issue in the above link.
In order to avoid some conflict on listening port, I like the following step:
1) using the following to launch a repl in remote machine(eg. ubuntu)
JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y" lein repl
"suspend=y" is very important, and the remote repl will tell you it will listen in which port, eg.
Listening for transport dt_socket at address: 49044
2) creating a remote debug config and setting attaching point (eg. 49044)
3) liking 2's local debug, you can start to your remote debug(Noting: you must generate .class file for your source project)
Good luck to you!