• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Deploying/Distributing Clojure App

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How does one deploy a Clojure app? Is it like groovy/jruby where you compile your app and include the interpreter jar within the overall jar?
 
Rancher
Posts: 379
22
Mac OS X Monad Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can package Clojure as source with the compiler and runtime library/ies (Clojure is compiled on the fly to bytecode, it is not interpreted) in a JAR.

You can also compile AOT (Ahead Of Time) to .class files and package those up with the runtime library/ies in a JAR.

If you're building web apps, you can package everything up in a WAR for deployment (the Leiningen build tool makes all of this very easy).

Other options include deploying source code in a folder tree on the classpath, load the entry point scripts with clojure.lang.RT and start invoking code from the host language (the Clojure scripts are compiled to bytecode on the fly, not interpreted). That's mostly how I use Clojure from my web application right now - I can make changes to the Clojure code, and just reload it into the runtime without any restarts needed.

BTW, that reminds me of another point that I don't think has been mentioned yet in threads... It's possible to connect a REPL (Read-Eval-Print-Loop) client to an existing, running Clojure application and run code against it, even hot swapping definitions of variables and functions if you want. That means you can monitor, manage, maintain and update live, running Clojure applications without downtime if you really need to.
 
Dan King
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sean Corfield wrote:Other options include deploying source code in a folder tree on the classpath, load the entry point scripts with clojure.lang.RT and start invoking code from the host language (the Clojure scripts are compiled to bytecode on the fly, not interpreted). That's mostly how I use Clojure from my web application right now - I can make changes to the Clojure code, and just reload it into the runtime without any restarts needed.



As an side, do you use a clojure web framework? If yes, which one and why?
 
Sean Corfield
Rancher
Posts: 379
22
Mac OS X Monad Clojure Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dan King wrote:As an side, do you use a clojure web framework? If yes, which one and why?


I don't currently. What's available right now are micro-frameworks and I don't yet think Clojure has a strong story for web page templating. Things are definitely improving, and with the Enlive templating library becoming an officially supported "contrib" library for 1.3 there will probably be some good solutions "soon".

What I'm using right now is the JBoss community project Railo which is a fast, free, open source implementation of CFML, originally Allaire's / Macromedia's / Adobe's server side web platform language. Railo's small footprint, fast bytecode compiler, full OO scripting language - as well as the original tag-based templating language - and rich feature set make it the best web framework I've found. Like Clojure it offers edit-refresh-test without a deployment/restart and of course has full interop with Java on the JVM.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use compojure for routing and just use hiccup for templating. The lein-ring plugin is very handy for development, as it supports live changes to the application, no reloading is necessary, just refresh the browser, the change is already there.


Dan King wrote:

Sean Corfield wrote:Other options include deploying source code in a folder tree on the classpath, load the entry point scripts with clojure.lang.RT and start invoking code from the host language (the Clojure scripts are compiled to bytecode on the fly, not interpreted). That's mostly how I use Clojure from my web application right now - I can make changes to the Clojure code, and just reload it into the runtime without any restarts needed.



As an side, do you use a clojure web framework? If yes, which one and why?

 
reply
    Bookmark Topic Watch Topic
  • New Topic