4

I'm using Eclipse (4.2.0) with Counteclockwise (0.10.1.STABLE001). I have a clojure namespace for which I would like to generate a class:

(ns a.b.c
  (:gen-class
   :name "a.b.c.Service"))

 (-method [] ...)

There is a defect, but it's marked as fixed as of version 0.59 here.

Is there a way that I can trigger or configure this from the IDE without resorting to a command-line compilation?

There is a related question, How to use a compiled Clojure class in Eclipse with Counterclockwise, but no solution.

Community
  • 1
  • 1
yakshaver
  • 2,472
  • 1
  • 18
  • 21

2 Answers2

1

I'll assume you are using CCW with leiningen and hence have a project.clj file:

add a like like this to project.clj:

:aot [org.example.sample]

You may not have a project.clj file if you used CCW to create the project

Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284
  • Unfortunately, I'm using m2e. We have considered the possibility of using leiningen instead, but are not ready to give up the hierarchical functionality provided by maven. – yakshaver Dec 20 '12 at 00:55
  • leiningen is a wrapper around maven, it produces a pom file and then calls maven. (run lein pom) – Arthur Ulfeldt Dec 20 '12 at 19:53
1

In Counterclockwise 0.10.1 (the version you're using), there is a simple way to do this: you have to start a launch configuration from the project's root node contextual menu (Run as > Clojure Application).

  • When launched from the project root, the builder will be configured to AOT compile the whole project everytime you save a file (and also when the launch starts, tho it has sometimes proven working unreliably). This means your namespace will be AOT compiled, and thus your gen-class.
Laurent Petit
  • 1,201
  • 7
  • 12