clojure web development newbie question: Could not locate net/cgrand/moustache__init.class or net/cgrand/moustache.clj on classpath

96 views
Skip to first unread message

vesnap

unread,
Apr 16, 2011, 10:02:05 AM4/16/11
to Clojure Web Development
Hi,
I am using Eclipse+Maven for development. And I am trying the examples
from https://github.com/swannodette/enlive-tutorial (Your First
Template – The Basics). I've added these dependencies in my pom.xml:
<dependency>

<groupId>ring</groupId>
<artifactId>ring-core</artifactId>
<version>0.3.1</version>
</dependency>
<dependency>
<groupId>ring</groupId>
<artifactId>ring-jetty-adapter</artifactId>
<version>0.3.1</version>
</dependency>
<dependency>
<groupId>net.cgrand</groupId>
<artifactId>moustache</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>

I have successfully build the project and I can see moustache and ring
in Maven dependencies in my project, but when I try to load the clj
file in repl, I get the following message: Could not locate net/cgrand/
moustache__init.class or net/cgrand/moustache.clj on classpath.

I know this is so basic, but I can't go any further without it, also
I've searched and searched over Internet, but couldn't find the
answer.
Thanks in advance!

Vesna

James Reeves

unread,
Apr 16, 2011, 10:42:40 AM4/16/11
to clojure...@googlegroups.com
On 16 April 2011 15:02, vesnap <vesna.p...@gmail.com> wrote:
> I am using Eclipse+Maven for development.

Out of curiosity, what made you decide on Maven? You might find it's
easier getting help for Leiningen or Cake, because they're more
commonly used.

- James

Jim Downing

unread,
Apr 18, 2011, 1:56:44 AM4/18/11
to clojure...@googlegroups.com
Hi Vesna,

On 16 April 2011 15:02, vesnap <vesna.p...@gmail.com> wrote:

In the project.clj file, it looks like the dependency is on Ring 0.2.5.

jim

Jim Downing

unread,
Apr 18, 2011, 2:10:52 AM4/18/11
to clojure...@googlegroups.com

Vesna will have his reasons, but since I'm replying on this thread
anyway: I use Maven for a mixture of clojure projects and Java
projects (and ones that contain both); it manages dependencies across
the lot. Hudson / Jenkins integration is falling-off-a-log simple.
There are loads of plugins for it, and writing your own is
straightforward.

That's the objective stuff anyway. The subjective is that I've used
Maven for a long time on the Java platform, and it's an investment
that makes me resistant to change - an hour spent on rejigging the
build is an hour not coding.

Cheers,
jim

vesnap

unread,
Apr 18, 2011, 11:26:00 AM4/18/11
to Clojure Web Development
Thanks Jim for taking my side, sort of, I replied to James, that it is
kind of a must to, because I'm doing this for my thesis.
Also I am used to eclipse, Maven is new to me, so that's why I started
using eclipse (first with ccw and clojure).
Jim the dependency is on the ring 0.3.1.
Now it works, but I have issue with: missing utils__init.class or
utils.clj on classpath, i my project.
the clj file is following(it is the template example from
https://github.com/swannodette/enlive-tutorial)

(ns com.bojanjovicic.clojureTest.scrape1
(:require [net.cgrand.enlive-html :as html])
(:use [net.cgrand.moustache :only [app]]
[com.bojanjovicic.clojureTest.scrape1.utils :only [run-server
render-to-response]]))

(html/deftemplate index "clojureTest/template1.html"
[ctxt]
[:p#message] (html/content (:message ctxt)))

;; ========================================
;; The App
;; ========================================

(def routes
(app
[""] (fn [req] (render-to-response
(index {})))
["change"] (fn [req] (render-to-response
(index {:message "We changed the
message!"})))
[&] {:status 404
:body "Page Not Found"}))

(defonce *server* (run-server routes))

(ns com.bojanjovicic.clojureTest.scrape1
(:require [net.cgrand.enlive-html :as html])
(:use [net.cgrand.moustache :only [app]]
[com.bojanjovicic.clojureTest.scrape1.utils :only [run-server
render-to-response]]))

(html/deftemplate index "clojureTest/template1.html"
[ctxt]
[:p#message] (html/content (:message ctxt)))

;; ========================================
;; The App
;; ========================================

(def routes
(app
[""] (fn [req] (render-to-response
(index {})))
["change"] (fn [req] (render-to-response
(index {:message "We changed the
message!"})))
[&] {:status 404
:body "Page Not Found"}))

(defonce *server* (run-server routes))

Thank you again!


On Apr 18, 8:10 am, Jim Downing <jimdown...@pobox.com> wrote:
> On 16 April 2011 15:42, James Reeves <jree...@weavejester.com> wrote:

vesnap

unread,
Apr 19, 2011, 5:15:18 AM4/19/11
to Clojure Web Development
I found the answer for this question. I didn't have utils.clj file in
my project, and of course it wasn't in classpath, like the message
indicated.

On Apr 18, 5:26 pm, vesnap <vesna.petko...@gmail.com> wrote:
> Thanks Jim for taking my side, sort of, I replied to James, that it is
> kind of a must to, because I'm doing this for my thesis.
> Also I am used to eclipse, Maven is new to me, so that's why I started
> using eclipse (first with ccw and clojure).
> Jim the dependency is on the ring 0.3.1.
> Now it works, but I have issue with: missing utils__init.class  or
> utils.clj on classpath, i my project.
> the clj file is following(it is the template example fromhttps://github.com/swannodette/enlive-tutorial)
Reply all
Reply to author
Forward
0 new messages