yakshaver
yakshaver

Reputation: 2492

Counterclockwise and :gen-class

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.

Upvotes: 4

Views: 225

Answers (2)

Laurent Petit
Laurent Petit

Reputation: 1201

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.

Upvotes: 1

Arthur Ulfeldt
Arthur Ulfeldt

Reputation: 91617

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

Upvotes: 1

Related Questions