2017-06-12 89 views
2

我一直在試圖找到一個3小時的解決方案,沒有什麼幫助。 有這樣的project.clj一個雷音項目:Lein編譯問題(Clojure)

(defproject funcs "0.1.0-SNAPSHOT" 
    :description "FIXME: write description" 
    :url "http://example.com/FIXME" 
    :license {:name "Eclipse Public License" 
      :url "http://www.eclipse.org/legal/epl-v10.html"} 
    :dependencies [[org.clojure/clojure "1.8.0"] 
       [org.xerial/sqlite-jdbc "3.7.2"]]) 

同時,有core.clj的頭:

(ns funcs.core 
    (:gen-class) 
    (:import (java.sql.Connection) 
      (java.sql.DriverManager) 
      (java.sql.ResultSet) 
      (java.sql.SQLException) 
      (java.sql.Statement)) 
    (:require [clojure.string :as str] 
      [clojure.java.jdbc :as j])) ; JDBC Driver for SQLite 

我嘗試編譯核心lein deps後.clj,但得到:

Compiling src/funcs/core.clj 
Could not locate funcs/core/clj__init.class or funcs/core/clj.clj on classpath. 
Exception in thread "main" java.io.FileNotFoundException: Could not locate funcs/core/clj__init.class or funcs/core/clj.clj on classpath., compiling:(/tmp/form-init8916675856325046616.clj:1:73) 
    at clojure.lang.Compiler.load(Compiler.java:7391) 
    at clojure.lang.Compiler.loadFile(Compiler.java:7317) 
    at clojure.main$load_script.invokeStatic(main.clj:275) 
    at clojure.main$init_opt.invokeStatic(main.clj:277) 
    at clojure.main$init_opt.invoke(main.clj:277) 
    at clojure.main$initialize.invokeStatic(main.clj:308) 
    at clojure.main$null_opt.invokeStatic(main.clj:342) 
    at clojure.main$null_opt.invoke(main.clj:339) 
    at clojure.main$main.invokeStatic(main.clj:421) 
    at clojure.main$main.doInvoke(main.clj:384) 
    at clojure.lang.RestFn.invoke(RestFn.java:421) 
    at clojure.lang.Var.invoke(Var.java:383) 
    at clojure.lang.AFn.applyToHelper(AFn.java:156) 
    at clojure.lang.Var.applyTo(Var.java:700) 
    at clojure.main.main(main.java:37) 
Caused by: java.io.FileNotFoundException: Could not locate funcs/core/clj__init.class or funcs/core/clj.clj on classpath. 
    at clojure.lang.RT.load(RT.java:456) 
    at clojure.lang.RT.load(RT.java:419) 
    at clojure.core$load$fn__5677.invoke(core.clj:5893) 
    at clojure.core$load.invokeStatic(core.clj:5892) 
    at clojure.core$load.doInvoke(core.clj:5876) 
    at clojure.lang.RestFn.invoke(RestFn.java:408) 
    at clojure.core$load_one.invokeStatic(core.clj:5697) 
    at clojure.core$compile$fn__5682.invoke(core.clj:5903) 
    at clojure.core$compile.invokeStatic(core.clj:5903) 
    at clojure.core$compile.invoke(core.clj:5895) 
    at user$eval20$fn__29.invoke(form-init8916675856325046616.clj:1) 
    at user$eval20.invokeStatic(form-init8916675856325046616.clj:1) 
    at user$eval20.invoke(form-init8916675856325046616.clj:1) 
    at clojure.lang.Compiler.eval(Compiler.java:6927) 
    at clojure.lang.Compiler.eval(Compiler.java:6917) 
    at clojure.lang.Compiler.eval(Compiler.java:6917) 
    at clojure.lang.Compiler.load(Compiler.java:7379) 
    ... 14 more 
Compilation failed: Subprocess failed 

命令ls -R輸出:

.: 
CHANGELOG.md LICENSE  README.md src  test 
doc   project.clj resources target 

./doc: 
intro.md 

./resources: 

./src: 
funcs 

./src/funcs: 
core.clj 

./target: 
classes native stale 

./target/classes: 
META-INF 

./target/classes/META-INF: 
maven 

./target/classes/META-INF/maven: 
funcs 

./target/classes/META-INF/maven/funcs: 
funcs 

./target/classes/META-INF/maven/funcs/funcs: 
pom.properties 

./target/native: 
Linux Mac Windows 

./target/native/Linux: 
amd64 i386 

./target/native/Linux/amd64: 
libsqlitejdbc.so 

./target/native/Linux/i386: 
libsqlitejdbc.so 

./target/native/Mac: 
i386 x86_64 

./target/native/Mac/i386: 
libsqlitejdbc.jnilib 

./target/native/Mac/x86_64: 
libsqlitejdbc.jnilib 

./target/native/Windows: 
amd64 x86 

./target/native/Windows/amd64: 
sqlitejdbc.dll 

./target/native/Windows/x86: 
sqlitejdbc.dll 

./target/stale: 
leiningen.core.classpath.extract-native-dependencies 

./test: 
funcs 

./test/funcs: 
core_test.clj 

所以我不知道問題出在哪裏。幫助plz =)

+0

請在項目根目錄中包含linux'ls -R .'或同等文件。 – Thumbnail

+0

@縮略圖完成! – errfrom

+0

通過替換 '[org.xerial/sqlite-jdbc「3.7.15-M1」]'上的'[org.xerial/sqlite-jdbc「3.7.2」]'解決了該問題。 – errfrom

回答

5

my-functions.core應該是funcs.core在您的名稱空間定義中。因此,而不是:

(ns my-functions.core ...) 

有:

(ns funcs.core ...) 

的問題是,它似乎命名空間的名稱和目錄中的文件是並不一致的名稱。另一種解決方案是將目錄名稱從funcs更改爲my-functions

+0

我改變了,但問題依然存在=( – errfrom

+0

當事情變得不好時,總是試一試'lein clean' –