Posts mit dem Label Clojure werden angezeigt. Alle Posts anzeigen
Posts mit dem Label Clojure werden angezeigt. Alle Posts anzeigen

Sonntag, 15. August 2010

Import a Clojure Leiningen Project into Eclipse

To import a leiningen project in the Eclipse IDE add the eclipse leiningen plugin in the project.clj as dev-dependency.


When you now invoke the command "lein help" there is a new task called eclipse. Invoke the leiningen task eclipse via "lein eclipse". The eclipse leiningen tasks creates the eclipse projects files ".project" and ".classpath".

Now you can import the project in the eclipse IDE, therefore you can use the import eclipse wizard. Therefore select "File->Import->Existing Project into Workspace" then click the next button and select the leiningen project as root directory now you can import the project via click on the finish button.


When you have installed the eclipse plugin counterclockwise you can know develop with syntax highlighting, run the project and debug the project from the eclipse IDE.



Links

Samstag, 14. August 2010

My first Clojure Web Application

I’m a fan of LISP, so I'm known a fan of Clojure, because Clojure brings LISP features to the Java platform. I don’t know if Clojure is good programming language for production use or for my daily work, but it makes a lot of fun to develop in Clojure, just try it. My first step was to write in clojure a simple hello world web application.

I choose leinigen as build and dependency management tool and the clojure web framework Compojure to develop a super simple hello world web application.

Here are the steps how I create my first hello world web application in clojure in 3 minutes:

1.) Download Leiningen
Download the lein bash script from:

http://github.com/technomancy/leiningen/raw/stable/bin/lein

2.) Install Leiningen
Invoke the bash script with the follow command:

lein self-install

3.) Create a New Clojure Project
Creating a new project with leinigen, therefore invoke the follow command:

lein new helloworld-webapp

4.) Add Compojure Dependency
Add the compojure dependency to the project, therefore add the follow dependecies to the project.clj file.


5.) Create the Hello World Application
Add the follow lines of code in "src/helloworld_webapp/core.clj"


6.) Run the Web Application
To start the hello world web application invoke the follow command:

lein test

7.) Invoke the Application
Now you can use the simple web application in your favorite browser open the URL:

http://localhost:8080/

Source Code
The source code of this simple demo can be found on GitHub:
http://github.com/tux2323/clojure-helloworld-webapp


Links