jjm
jjm

Reputation: 6198

Error building clojure project with lein

I'm not at all familiar with clojure, and I have the source for a project that I'm trying to build. The project has a project.clj file, which google says means I should use the lein build tool. However:

$ lein compile #lein jar does the same thing
Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: Could not locate testui/core__init.class oCompiling testui.core
r testui/core.clj on classpath

I suspect that project.clj may be broken. core.clj is located in src/com/foodient/semanticanalysis/testui, and project.clj looks like this:

(defproject testui "1.0.0-SNAPSHOT"
  :description "FIXME: write description"
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.apache.poi/poi "3.8-beta4"]
                 [gate-clj "1.0.0"]]
  :aot [testui.core]
  :main testui.core
  :run-aliases {:test testui.core/-main})

Any ideas?

Upvotes: 4

Views: 2026

Answers (3)

Igor Kupczyński
Igor Kupczyński

Reputation: 516

My guess is that you should change references to your code from

testui.core

to

com.foodient.semanticanalysis.testui.core

The reason for it is that the part of a namespace before the last dot corresponds to a package name (this term comes from java and jvm)

You indicated that your sources are in:

src/com/foodient/semanticanalysis/testui

so the package name is com.foodient.semanticanalysis.testui

You should probably also update the namespace declaration in your clojure source files to match this convention (or move your source to src/testui).

Hope it helps.

Upvotes: 3

octopusgrabbus
octopusgrabbus

Reputation: 10695

If you set up a lein project and the name has that Clojuristic dash in it, like bene-csv (one of mine), then lein new bene-csv creates several directories and ./bene-csv/project.clj. My core.clj is located in ./bene-csv/src/bene_csv/core.clj. Note the dash is dropped in bene_csv in favor of an underscore.

As to your problem more than likely core.clj is not located where lein expects it, which should be ./testui/src/testui/core.clj. I hope this helps.

Upvotes: 4

DanLebrero
DanLebrero

Reputation: 8591

I think the issue is that the core.clj is not in the right directory. It should be in the src/testui directory.

Upvotes: 3

Related Questions