going from leiningen to gradle+clojuresque

869 views
Skip to first unread message

rundis

unread,
Aug 30, 2012, 2:37:53 AM8/30/12
to cloju...@googlegroups.com
Hi !

We have a (multi) project consisting of several individual submodules. We currently use leiningen to build the projects and their interdependencies handled by deploying jars/snapshots to maven repo (local/remote).
To simplify building all projects and to handle a few non clojure projects we are considering switching to gradle.

We've managed to get a gradle multi project up and running using the clojuresque plugin (in parallel with the existing leiningen configurations). However there are a few things from our leiningen setup we are wondering how to reproduce using the gradle+clojuresque build.

1) We use ring and we currently use the lein-ring plugin for dev testing and development. Any suggestions on how to achieve something similar with gradle ? Using the jetty-plugin in gradle springs to mind, but that has a precondition of the projects being war projects not self-contained jars right ?

2) Repl: Any suggestions on supporting repl using gradle+clojuresque

3) Tips on setup/issues with regards to Hooking up an IDE (intellij/eclipse) to support "interacting" with running clojure processes during developement


cheers
-magnus

Meikel Brandmeyer

unread,
Aug 30, 2012, 3:01:03 AM8/30/12
to cloju...@googlegroups.com
Hi,


Am Donnerstag, 30. August 2012 08:37:53 UTC+2 schrieb rundis:
We have a (multi) project consisting of several individual submodules. We currently use leiningen to build the projects and their interdependencies handled by deploying jars/snapshots to maven repo (local/remote).
To simplify building all projects and to handle a few non clojure projects we are considering switching to gradle.

We've managed to get a gradle multi project up and running using the clojuresque plugin (in parallel with the existing leiningen configurations). However there are a few things from our leiningen setup we are wondering how to reproduce using the gradle+clojuresque build.

1) We use ring and we currently use the lein-ring plugin for dev testing and development. Any suggestions on how to achieve something similar with gradle ? Using the jetty-plugin in gradle springs to mind, but that has a precondition of the projects being war projects not self-contained jars right ?

I don't do much web development. But I used this task once in a project to get a local server running:

task runJetty(type: clojuresque.ClojureExec) {
    classpath = project.files([
        project.sourceSets.main.clojure.srcDirs,
        project.sourceSets.main.resources.srcDirs,
        project.configurations.runtime,
        project.configurations.development
    ])
    main = "your.server/start-server"
    args = []
}

The start-server function is rather simple:

(defn start-server
  []
  (jetty/run-jetty #'handler {:host "127.0.0.1" :port 8080}))

Quite simple but worked for me.
 
2) Repl: Any suggestions on supporting repl using gradle+clojuresque

gradle doesn't really provide easy access to stdin and stdout. So I don't think so. I usually use the VimClojure repl through an embedded nailgun server (started by gradle). (Or recently CCW+Eclipse at work) There is a gradle plugin to start the nailgun server (see vimclojure/gradle on clojars). I'm working to extend this to also provide a nrepl server. But this is not done at the moment.
 
3) Tips on setup/issues with regards to Hooking up an IDE (intellij/eclipse) to support "interacting" with running clojure processes during developement

At work I have a working Eclipse+CCW setup which uses the eclipse gradle plugin to handle the classpath. Everything works together and getting an embedded repl in Eclipse up and running was completely without trouble. Here you could also start the server in a background thread. I haven't tried to connect eclipse to a separatly started nrepl server. Regarding Eclipse and CCW you best ask on the ccw group.

CCW: https://groups.google.com/forum/?fromgroups#!forum/clojuredev-users
Gradle Plugin for eclipse: http://static.springsource.org/sts/docs/latest/reference/html/gradle/

Please let me know in case you run into trouble. But be advised that I will be almost unreachable for the next two weeks.

Kind regards
Meikel

Reply all
Reply to author
Forward
0 new messages