2017-06-12 2 views
2

J'ai essayé de trouver une solution pendant 3 heures, rien n'y fait. Il y a un projet lein avec un tel project.clj:Problèmes avec lein compile (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"]]) 

De plus, il y a un en-tête de 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 

Après lein deps je tente de compiler noyau .clj, mais obtenir:

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 

Commande ls -R sortie:

.: 
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 

Je n'ai donc aucune idée d'où le problème. Aide plz =)

+0

Veuillez inclure linux 'ls -R .' ou équivalent à partir du répertoire racine du projet. – Thumbnail

+0

@Thumbnail Fait! – errfrom

+0

Le problème a été résolu en remplaçant [org.xerial/sqlite-jdbc "3.7.2"] 'sur ' [org.xerial/sqlite-jdbc "3.7.15-M1"] '. – errfrom

Répondre

5

my-functions.core doit être funcs.core dans votre définition d'espace de noms. Ainsi, plutôt que:

(ns my-functions.core ...) 

ont:

(ns funcs.core ...) 

Le problème est qu'il semble que le nom de l'espace de noms et le nom du répertoire que le fichier est en sont en désaccord. Une solution alternative serait de changer le nom du répertoire de funcs à my-functions.

+0

J'ai changé, mais le problème est resté = ( – errfrom

+0

Quand les choses tournent mal, essayez toujours un 'lein clean' –