This week's book giveaway is in the Python forum.
We're giving away four copies of Hello World and have Warren & Carter Sande on-line!
See this thread for details.
Win a copy of Hello World this week in the Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Deploying/Distributing Clojure App

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • 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: 352
21
Mac OS X Monad Clojure Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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: 352
21
Mac OS X Monad Clojure Linux
  • Mark post as helpful
  • send pies
  • 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
  • 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?

 
I hired a bunch of ninjas. The fridge is empty, but I can't find them to tell them the mission.
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!