cannot run lein script - clojure

I've downloaded lein, put it in my /bin folder, and made it executable. I've also downloaded java:
$java -version
java version "1.7.0_65"
But I get the following error upon running the command:
$lein
java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.util.Map$Entry
at clojure.lang.APersistentMap$ValSeq.first (APersistentMap.java:185)
clojure.lang.RT.first (RT.java:577)
clojure.core$first.invoke (core.clj:55)
clojure.core$map$fn__4245.invoke (core.clj:2559)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.RT.seq (RT.java:484)
clojure.core$seq.invoke (core.clj:133)
clojure.core$zipmap.invoke (core.clj:2788)
leiningen.core.utils$map_vals.doInvoke (utils.clj:115)
clojure.lang.RestFn.invoke (RestFn.java:442)
leiningen.core.user/fn (user.clj:69)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invoke (core.clj:624)
clojure.core$memoize$fn__5097.doInvoke (core.clj:5846)
clojure.lang.RestFn.invoke (RestFn.java:408)
leiningen.core.user/fn (user.clj:85)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invoke (core.clj:624)
clojure.core$memoize$fn__5097.doInvoke (core.clj:5846)
clojure.lang.RestFn.invoke (RestFn.java:397)
leiningen.core.project$read_profiles.invoke (project.clj:622)
leiningen.core.project$project_with_profiles.invoke (project.clj:736)
leiningen.core.main$_main$fn__5979.invoke (main.clj:358)
leiningen.core.main$_main.doInvoke (main.clj:353)
clojure.lang.RestFn.invoke (RestFn.java:397)
clojure.lang.Var.invoke (Var.java:375)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invoke (core.clj:624)
clojure.main$main_opt.invoke (main.clj:315)
clojure.main$main.doInvoke (main.clj:420)
clojure.lang.RestFn.invoke (RestFn.java:421)
clojure.lang.Var.invoke (Var.java:383)
clojure.lang.AFn.applyToHelper (AFn.java:156)
clojure.lang.Var.applyTo (Var.java:700)
clojure.main.main (main.java:37)
I get this when I try to make my first project also:
$lein new compojure-app guestbook
java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.util.Map$Entry
at clojure.lang.APersistentMap$ValSeq.first (APersistentMap.java:185)
clojure.lang.RT.first (RT.java:577)
clojure.core$first.invoke (core.clj:55)
clojure.core$map$fn__4245.invoke (core.clj:2559)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.RT.seq (RT.java:484)
clojure.core$seq.invoke (core.clj:133)
clojure.core$zipmap.invoke (core.clj:2788)
leiningen.core.utils$map_vals.doInvoke (utils.clj:115)
clojure.lang.RestFn.invoke (RestFn.java:442)
leiningen.core.user/fn (user.clj:69)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invoke (core.clj:624)
clojure.core$memoize$fn__5097.doInvoke (core.clj:5846)
clojure.lang.RestFn.invoke (RestFn.java:408)
leiningen.core.user/fn (user.clj:85)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invoke (core.clj:624)
clojure.core$memoize$fn__5097.doInvoke (core.clj:5846)
clojure.lang.RestFn.invoke (RestFn.java:397)
leiningen.core.project$read_profiles.invoke (project.clj:622)
leiningen.core.project$project_with_profiles.invoke (project.clj:736)
leiningen.core.main$_main$fn__5979.invoke (main.clj:358)
leiningen.core.main$_main.doInvoke (main.clj:353)
clojure.lang.RestFn.invoke (RestFn.java:436)
clojure.lang.Var.invoke (Var.java:388)
clojure.lang.AFn.applyToHelper (AFn.java:160)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invoke (core.clj:624)
clojure.main$main_opt.invoke (main.clj:315)
clojure.main$main.doInvoke (main.clj:420)
clojure.lang.RestFn.invoke (RestFn.java:482)
clojure.lang.Var.invoke (Var.java:401)
clojure.lang.AFn.applyToHelper (AFn.java:171)
clojure.lang.Var.applyTo (Var.java:700)
clojure.main.main (main.java:37)
What is the problem here? Thank you in advance.

As per Alex's comment, the problem was solved by replacing the malformed .lein/profiles.clj:
$nano .lein/profiles.clj
[lein-ancient "0.5.5"]
with a properly formed profile . I used this profile, found at gist.github.com/devn/4403577 :
{:user {:plugins [[lein-swank "1.4.5"]
;; [lein-pedantic "0.0.5"]
;; [lein-ritz "0.6.0"]
[lein-checkout-deps "1.0.0"]
;; [lein-haml-sass "0.2.4"]
[lein-midje "2.0.1"]
[lein-kibit "0.0.7"]]}
{:dependencies [[slamhound "1.3.0"]]}
{:aliases {"slamhound" ["run" "-m" "slam.hound"]}}}

Related

Syntax error compiling in Clojure leiningen

I have a project named cheshire-cat in which I am trying to run Rhino-based ClojureScript REPL with the command lein trampoline cljsbuild repl-rhino. It gives an exception in thread "main" and terminates.
What is the problem? Following is the terminal output:
$lein trampoline cljsbuild repl-rhino
Running Rhino-based ClojureScript REPL.
Exception in thread "main" Syntax error compiling at (cljs/repl.clj:1:1).
at clojure.lang.Compiler.load(Compiler.java:7647)
at clojure.lang.RT.loadResourceScript(RT.java:381)
at clojure.lang.RT.loadResourceScript(RT.java:372)
at clojure.lang.RT.load(RT.java:463)
at clojure.lang.RT.load(RT.java:428)
at clojure.core$load$fn__6824.invoke(core.clj:6126)
at clojure.core$load.invokeStatic(core.clj:6125)
at clojure.core$load.doInvoke(core.clj:6109)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invokeStatic(core.clj:5908)
at clojure.core$load_one.invoke(core.clj:5903)
at clojure.core$load_lib$fn__6765.invoke(core.clj:5948)
at clojure.core$load_lib.invokeStatic(core.clj:5947)
at clojure.core$load_lib.doInvoke(core.clj:5928)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$load_libs.invokeStatic(core.clj:5985)
at clojure.core$load_libs.doInvoke(core.clj:5969)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$require.invokeStatic(core.clj:6007)
at clojure.core$require.doInvoke(core.clj:6007)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at cljsbuild.repl.rhino$eval144$loading__6706__auto____145.invoke(rhino.clj:1)
at cljsbuild.repl.rhino$eval144.invokeStatic(rhino.clj:1)
at cljsbuild.repl.rhino$eval144.invoke(rhino.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:7176)
at clojure.lang.Compiler.eval(Compiler.java:7165)
at clojure.lang.Compiler.load(Compiler.java:7635)
at clojure.lang.RT.loadResourceScript(RT.java:381)
at clojure.lang.RT.loadResourceScript(RT.java:372)
at clojure.lang.RT.load(RT.java:463)
at clojure.lang.RT.load(RT.java:428)
at clojure.core$load$fn__6824.invoke(core.clj:6126)
at clojure.core$load.invokeStatic(core.clj:6125)
at clojure.core$load.doInvoke(core.clj:6109)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invokeStatic(core.clj:5908)
at clojure.core$load_one.invoke(core.clj:5903)
at clojure.core$load_lib$fn__6765.invoke(core.clj:5948)
at clojure.core$load_lib.invokeStatic(core.clj:5947)
at clojure.core$load_lib.doInvoke(core.clj:5928)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$load_libs.invokeStatic(core.clj:5985)
at clojure.core$load_libs.doInvoke(core.clj:5969)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.core$require.invokeStatic(core.clj:6007)
at clojure.core$require.doInvoke(core.clj:6007)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at user$eval5.invokeStatic(form-init5565266544074168037.clj:1)
at user$eval5.invoke(form-init5565266544074168037.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:7176)
at clojure.lang.Compiler.eval(Compiler.java:7165)
at clojure.lang.Compiler.load(Compiler.java:7635)
at clojure.lang.Compiler.loadFile(Compiler.java:7573)
at clojure.main$load_script.invokeStatic(main.clj:452)
at clojure.main$init_opt.invokeStatic(main.clj:454)
at clojure.main$init_opt.invoke(main.clj:454)
at clojure.main$initialize.invokeStatic(main.clj:485)
at clojure.main$null_opt.invokeStatic(main.clj:519)
at clojure.main$null_opt.invoke(main.clj:516)
at clojure.main$main.invokeStatic(main.clj:598)
at clojure.main$main.doInvoke(main.clj:561)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.main.main(main.java:37)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:69)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at clojure.lang.DynamicClassLoader.loadClass(DynamicClassLoader.java:77)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:495)
at java.base/java.lang.Class.forName(Class.java:474)
at clojure.lang.RT.classForName(RT.java:2207)
at clojure.lang.RT.classForNameNonLoading(RT.java:2220)
at cljs.repl$eval150$loading__6706__auto____151.invoke(repl.clj:9)
at cljs.repl$eval150.invokeStatic(repl.clj:9)
at cljs.repl$eval150.invoke(repl.clj:9)
at clojure.lang.Compiler.eval(Compiler.java:7176)
at clojure.lang.Compiler.eval(Compiler.java:7165)
at clojure.lang.Compiler.load(Compiler.java:7635)
... 67 more
This is my project.clj file:
(defproject cheshire-cat "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:min-lein-version "2.0.0"
:dependencies [[org.clojure/clojure "1.10.0"]
[compojure "1.6.1"]
[ring/ring-defaults "0.3.2"]
[ring/ring-json "0.5.1"]
[org.clojure/clojurescript "0.0-2371"]]
:plugins [[lein-ring "0.12.6"]
[lein-cljsbuild "1.1.8"]]
:ring {:handler cheshire-cat.handler/app}
:profiles
{:dev {:dependencies [[javax.servlet/servlet-api "2.5"]
[ring/ring-mock "0.3.2"]]}}
:cljsbuild {
:builds [{
:source-paths ["src-cljs"]
:compiler {
:output-to "resources/public/main.js"
:optimizations :whitespace
:pretty-print true}}]})
I tried to change the dependencies version to make it work but it didn't.
How to remove this error and make the command run the REPL without any error. Thanks.
This is an issue with using newer JDKs (9+) with older software that used some packages only available until JDK8. You can fix this by adding
[javax.xml.bind/jaxb-api "2.3.1"]
to your :dependencies in project.clj.
It's not about dependencies, it's about the JDK version: https://stackoverflow.com/a/43574427/564509
And there's already an issue for that: https://github.com/emezeske/lein-cljsbuild/issues/499

Deploy clojure packages to clojar

I am trying to deploy a package to clojars.
When I run lein deploy clojars command, I get
following error
java.lang.IllegalArgumentException: Must provide valid :files to deploy-artifacts
at cemerick.pomegranate.aether$deploy_artifacts.invokeStatic (aether.clj:346)
cemerick.pomegranate.aether$deploy_artifacts.doInvoke (aether.clj:312)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invokeStatic (core.clj:665)
clojure.core$apply.invoke (core.clj:660)
cemerick.pomegranate.aether$deploy.invokeStatic (aether.clj:431)
cemerick.pomegranate.aether$deploy.doInvoke (aether.clj:395)
clojure.lang.RestFn.invoke (RestFn.java:1096)
leiningen.deploy$deploy.invokeStatic (deploy.clj:235)
leiningen.deploy$deploy.doInvoke (deploy.clj:172)
clojure.lang.RestFn.invoke (RestFn.java:470)
clojure.lang.AFn.applyToHelper (AFn.java:165)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.lang.Var.applyTo (Var.java:705)
clojure.core$apply.invokeStatic (core.clj:667)
clojure.core$apply.invoke (core.clj:660)
leiningen.core.main$partial_task$fn__7330.doInvoke (main.clj:284)
clojure.lang.RestFn.applyTo (RestFn.java:139)
clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invokeStatic (core.clj:667)
clojure.core$apply.invoke (core.clj:660)
leiningen.core.main$apply_task.invokeStatic (main.clj:334)
leiningen.core.main$apply_task.invoke (main.clj:320)
leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
leiningen.core.main$_main$fn__7419.invoke (main.clj:453)
leiningen.core.main$_main.invokeStatic (main.clj:442)
leiningen.core.main$_main.doInvoke (main.clj:439)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.lang.Var.applyTo (Var.java:705)
clojure.core$apply.invokeStatic (core.clj:665)
clojure.main$main_opt.invokeStatic (main.clj:514)
clojure.main$main_opt.invoke (main.clj:510)
clojure.main$main.invokeStatic (main.clj:664)
clojure.main$main.doInvoke (main.clj:616)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.lang.Var.applyTo (Var.java:705)
clojure.main.main (main.java:40)
Not sure whats the requirement around :files option.
Any help is appreciated.
Thanks
Update
Here is the link to the project https://github.com/ludbek/sql-compose
The issue has been fixed. Not sure what went wrong with lein. Instead of using lein I used mvn to deploy the package.
The blog post below was helpful.
https://oli.me.uk/clojure-projects-from-scratch/

Leiningen throws clojure.lang.PersistentVector cannot be cast to clojure.lang.Named

I'm a Java developer taking first steps with Clojure. I have put together a simple project using Leiningen 2.8.1 and Clojure 1.9.0. The code of my project is available here.
My problem is very simple. When I run "lein" from the console I get this error:
java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Named
at clojure.core$name.invokeStatic (core.clj:1546)
clojure.core$name.invoke (core.clj:1540)
leiningen.core.project$absolutize_path.invokeStatic (project.clj:453)
leiningen.core.project$absolutize_path.invoke (project.clj:452)
clojure.core.protocols$iter_reduce.invokeStatic (protocols.clj:49)
clojure.core.protocols$fn__6744.invokeStatic (protocols.clj:75)
clojure.core.protocols/fn (protocols.clj:75)
clojure.core.protocols$fn__6684$G__6679__6697.invoke (protocols.clj:13)
clojure.core$reduce.invokeStatic (core.clj:6545)
clojure.core$reduce.invoke (core.clj:6527)
leiningen.core.project$absolutize_paths.invokeStatic (project.clj:463)
leiningen.core.project$absolutize_paths.invoke (project.clj:462)
leiningen.core.project$init_profiles.invokeStatic (project.clj:887)
leiningen.core.project$init_profiles.doInvoke (project.clj:865)
clojure.lang.RestFn.invoke (RestFn.java:425)
leiningen.core.project$init_project.invokeStatic (project.clj:950)
leiningen.core.project$init_project.invoke (project.clj:942)
leiningen.core.project$read.invokeStatic (project.clj:1023)
leiningen.core.project$read.invoke (project.clj:1020)
leiningen.core.project$read.invokeStatic (project.clj:1024)
leiningen.core.project$read.invoke (project.clj:1020)
leiningen.core.main$_main$fn__4734.invoke (main.clj:416)
leiningen.core.main$_main.invokeStatic (main.clj:411)
leiningen.core.main$_main.doInvoke (main.clj:408)
clojure.lang.RestFn.invoke (RestFn.java:397)
clojure.lang.Var.invoke (Var.java:375)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invokeStatic (core.clj:646)
clojure.main$main_opt.invokeStatic (main.clj:314)
clojure.main$main_opt.invoke (main.clj:310)
clojure.main$main.invokeStatic (main.clj:421)
clojure.main$main.doInvoke (main.clj:384)
clojure.lang.RestFn.invoke (RestFn.java:421)
clojure.lang.Var.invoke (Var.java:383)
clojure.lang.AFn.applyToHelper (AFn.java:156)
clojure.lang.Var.applyTo (Var.java:700)
clojure.main.main (main.java:37)
It doesn't matter if I run lein or lein test, the result is the same. And I don't see any reference to my code in the stack trace, so I'm clueless.
Any ideas of what's wrong?
Thanks in advance.
Your project.clj file is missing a closing bracket here.
:dependencies [[org.clojure/clojure "1.8.0"]
[mount "0.1.11"] ;; delete extra bracket
[midje "1.9.1"]
[com.datomic/datomic-free "0.9.5656"]] ;; add closing bracket

Leiningen is installed but I Get Error When Attempting to Run

I have Leiningen installed on my computer here: /usr/local/bin/lein (version 2.7.1)
I have Java installed here: /usr/bin/java (version 1.8.0_74)
I have set Leiningen it to be executable, and yet when I go to run "lein", I get the following error message:
"java.lang.Exception: Error loading /Users/jessierichardson/Desktop/project.clj
at leiningen.core.project$read_raw$fn__6407.invoke (project.clj:962)
leiningen.core.project$read_raw.invokeStatic (project.clj:956)
leiningen.core.project$read_raw.invoke (project.clj:952)
leiningen.core.project$read.invokeStatic (project.clj:973)
leiningen.core.project$read.invoke (project.clj:970)
leiningen.core.project$read.invokeStatic (project.clj:974)
leiningen.core.project$read.invoke (project.clj:970)
leiningen.core.main$_main$fn__5998.invoke (main.clj:397)
leiningen.core.main$_main.invokeStatic (main.clj:394)
leiningen.core.main$_main.doInvoke (main.clj:391)
clojure.lang.RestFn.invoke (RestFn.java:397)
clojure.lang.Var.invoke (Var.java:375)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invokeStatic (core.clj:646)
clojure.main$main_opt.invokeStatic (main.clj:314)
clojure.main$main_opt.invoke (main.clj:310)
clojure.main$main.invokeStatic (main.clj:421)
clojure.main$main.doInvoke (main.clj:384)
clojure.lang.RestFn.invoke (RestFn.java:421)
clojure.lang.Var.invoke (Var.java:383)
clojure.lang.AFn.applyToHelper (AFn.java:156)
clojure.lang.Var.applyTo (Var.java:700)
clojure.main.main (main.java:37)
Caused by: clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Unable to resolve symbol: bookmark88 in this context, compiling:(/Users/jessierichardson/Desktop/project.clj:0:0)
at clojure.lang.Compiler.analyze (Compiler.java:6688)
clojure.lang.Compiler.analyze (Compiler.java:6625)
clojure.lang.Compiler.eval (Compiler.java:6931)
clojure.lang.Compiler.load (Compiler.java:7379)
clojure.lang.Compiler.loadFile (Compiler.java:7317)
clojure.lang.RT$3.invoke (RT.java:320)
leiningen.core.project$read_raw$fn__6407.invoke (project.clj:960)
leiningen.core.project$read_raw.invokeStatic (project.clj:956)
leiningen.core.project$read_raw.invoke (project.clj:952)
leiningen.core.project$read.invokeStatic (project.clj:973)
leiningen.core.project$read.invoke (project.clj:970)
leiningen.core.project$read.invokeStatic (project.clj:974)
leiningen.core.project$read.invoke (project.clj:970)
leiningen.core.main$_main$fn__5998.invoke (main.clj:397)
leiningen.core.main$_main.invokeStatic (main.clj:394)
leiningen.core.main$_main.doInvoke (main.clj:391)
clojure.lang.RestFn.invoke (RestFn.java:397)
clojure.lang.Var.invoke (Var.java:375)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invokeStatic (core.clj:646)
clojure.main$main_opt.invokeStatic (main.clj:314)
clojure.main$main_opt.invoke (main.clj:310)
clojure.main$main.invokeStatic (main.clj:421)
clojure.main$main.doInvoke (main.clj:384)
clojure.lang.RestFn.invoke (RestFn.java:421)
clojure.lang.Var.invoke (Var.java:383)
clojure.lang.AFn.applyToHelper (AFn.java:156)
clojure.lang.Var.applyTo (Var.java:700)
clojure.main.main (main.java:37)
Caused by: java.lang.RuntimeException: Unable to resolve symbol: bookmark88 in this context
at clojure.lang.Util.runtimeException (Util.java:221)
clojure.lang.Compiler.resolveIn (Compiler.java:7164)
clojure.lang.Compiler.resolve (Compiler.java:7108)
clojure.lang.Compiler.analyzeSymbol (Compiler.java:7069)
clojure.lang.Compiler.analyze (Compiler.java:6648)
clojure.lang.Compiler.analyze (Compiler.java:6625)
clojure.lang.Compiler.eval (Compiler.java:6931)
clojure.lang.Compiler.load (Compiler.java:7379)
clojure.lang.Compiler.loadFile (Compiler.java:7317)
clojure.lang.RT$3.invoke (RT.java:320)
leiningen.core.project$read_raw$fn__6407.invoke (project.clj:960)
leiningen.core.project$read_raw.invokeStatic (project.clj:956)
leiningen.core.project$read_raw.invoke (project.clj:952)
leiningen.core.project$read.invokeStatic (project.clj:973)
leiningen.core.project$read.invoke (project.clj:970)
leiningen.core.project$read.invokeStatic (project.clj:974)
leiningen.core.project$read.invoke (project.clj:970)
leiningen.core.main$_main$fn__5998.invoke (main.clj:397)
leiningen.core.main$_main.invokeStatic (main.clj:394)
leiningen.core.main$_main.doInvoke (main.clj:391)
clojure.lang.RestFn.invoke (RestFn.java:397)
clojure.lang.Var.invoke (Var.java:375)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invokeStatic (core.clj:646)
clojure.main$main_opt.invokeStatic (main.clj:314)
clojure.main$main_opt.invoke (main.clj:310)
clojure.main$main.invokeStatic (main.clj:421)
clojure.main$main.doInvoke (main.clj:384)
clojure.lang.RestFn.invoke (RestFn.java:421)
clojure.lang.Var.invoke (Var.java:383)
clojure.lang.AFn.applyToHelper (AFn.java:156)
clojure.lang.Var.applyTo (Var.java:700)
clojure.main.main (main.java:37)"
I have a project in Clojure that I did several months ago that lein runs fine in and am up to date with current versions of lein and java.
Could someone please help?
When you run lein from a directory that is a lein project (has a project.clj file), it will try to parse the project file even though you did not give it any commands. If you run lein from a directory that is not a project, it will at least print out the commands available, as there's no project file to read.
There is an error "Unable to resolve symbol bookmark88" in the text above. This is in your project.clj file. Paste its contents to your original question if you need help, or examine it yourself to determine the problem. This is the reason you can't run lein.
I would recommend you put your project in its own directory, not on your desktop, as it seems you currently are. Then in your terminal change to the project directory (the one that contains project.clj) and run lein from there.

Wrong types still compile with clojure core.typed?

The project file:
(defproject testclojure "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.6.0"]
[org.clojure/core.typed "0.2.84"]
[alembic "0.3.2"]]
:main ^:skip-aot testclojure.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
The code:
(ns testclojure.core
(:gen-class)
(:require [clojure.core.typed :refer [ann AnyInteger check-ns]])
(:import [clojure.lang ISeq]))
(ann ^:no-check clojure.core/mod [AnyInteger AnyInteger -> AnyInteger])
(ann div-by [AnyInteger AnyInteger -> Boolean])
(defn div-by [x y]
(== (mod y x) 0))
(ann div-by-3-or-5 [AnyInteger -> Boolean])
(defn div-by-3-or-5 [x]
(or (div-by 3 x) (div-by 5 x)))
(ann euler1 [AnyInteger -> AnyInteger])
(defn euler1 [n]
(reduce + (filter div-by-3-or-5 (range n))))
(ann -main [-> nil] )
(defn -main []
(prn (euler1 "a")))
lein compile gives no error at all.
As the docstring for check-ns says:
Do not use check-ns within a checked namespace.
It is intended to be used at the REPL or within a unit test.
Suggested idiom for clojure.test: (is (check-ns 'your.ns))
If you put this in test/testclojure/core_test.clj:
(ns testclojure.core-test
(:require [clojure.test :refer :all]
[clojure.core.typed :refer [check-ns]]
testclojure.core))
(deftest core-typed
(is (check-ns 'testclojure.core)))
lein test will rightly complain about the type problem:
lein test testclojure.core-test
Initializing core.typed ...
Building core.typed base environments ...
Finished building base environments
"Elapsed time: 4251.270066 msecs"
core.typed initialized.
Start collecting testclojure.core
WARNING: Duplicate var annotation: clojure.core/mod
Finished collecting testclojure.core
Collected 1 namespaces in 833.458074 msecs
Not checking clojure.core.typed (does not depend on clojure.core.typed)
Start checking testclojure.core
Checked testclojure.core in 992.400431 msecs
Checked 2 namespaces in 1843.974821 msecs
Type Error (testclojure/core.clj:22:8) Function euler1 could not be applied to arguments:
Domains:
AnyInteger
Arguments:
(clojure.core.typed/Val "a")
Ranges:
AnyInteger
in: (euler1 "a")
in: (euler1 a)
lein test :only testclojure.core-test/core-typed
ERROR in (core-typed) (core.clj:4403)
expected: (check-ns (quote testclojure.core))
actual: clojure.lang.ExceptionInfo: Type Checker: Found 1 error
at clojure.core$ex_info.invoke (core.clj:4403)
clojure.core.typed.errors$print_errors_BANG_.invoke (errors.clj:234)
clojure.core.typed.check_ns_common$check_ns$fn__24049.invoke (check_ns_common.clj:114)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invoke (core.clj:624)
clojure.core$with_bindings_STAR_.doInvoke (core.clj:1862)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.core.typed.check_ns_common$check_ns.doInvoke (check_ns_common.clj:112)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.lang.AFn.applyToHelper (AFn.java:156)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.core$apply.invoke (core.clj:628)
clojure.core.typed.check_ns_clj$check_ns.doInvoke (check_ns_clj.clj:23)
clojure.lang.RestFn.invoke (RestFn.java:410)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.core$apply.invoke (core.clj:626)
clojure.core.typed$check_ns.doInvoke (typed.clj:2241)
clojure.lang.RestFn.invoke (RestFn.java:410)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.core$apply.invoke (core.clj:624)
testclojure.core_test/fn (core_test.clj:7)
clojure.test$test_var$fn__7187.invoke (test.clj:704)
clojure.test$test_var.invoke (test.clj:704)
clojure.test$test_vars$fn__7209$fn__7214.invoke (test.clj:722)
clojure.test$default_fixture.invoke (test.clj:674)
clojure.test$test_vars$fn__7209.invoke (test.clj:722)
clojure.test$default_fixture.invoke (test.clj:674)
clojure.test$test_vars.invoke (test.clj:718)
clojure.test$test_all_vars.invoke (test.clj:728)
clojure.test$test_ns.invoke (test.clj:747)
clojure.core$map$fn__4245.invoke (core.clj:2559)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.Cons.next (Cons.java:39)
clojure.lang.RT.boundedLength (RT.java:1654)
clojure.lang.RestFn.applyTo (RestFn.java:130)
clojure.core$apply.invoke (core.clj:626)
clojure.test$run_tests.doInvoke (test.clj:762)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invoke (core.clj:624)
user$eval85$fn__140$fn__171.invoke (form-init5812871912759411988.clj:1)
user$eval85$fn__140$fn__141.invoke (form-init5812871912759411988.clj:1)
user$eval85$fn__140.invoke (form-init5812871912759411988.clj:1)
user$eval85.invoke (form-init5812871912759411988.clj:1)
clojure.lang.Compiler.eval (Compiler.java:6703)
clojure.lang.Compiler.eval (Compiler.java:6693)
clojure.lang.Compiler.load (Compiler.java:7130)
clojure.lang.Compiler.loadFile (Compiler.java:7086)
clojure.main$load_script.invoke (main.clj:274)
clojure.main$init_opt.invoke (main.clj:279)
clojure.main$initialize.invoke (main.clj:307)
clojure.main$null_opt.invoke (main.clj:342)
clojure.main$main.doInvoke (main.clj:420)
clojure.lang.RestFn.invoke (RestFn.java:421)
clojure.lang.Var.invoke (Var.java:383)
clojure.lang.AFn.applyToHelper (AFn.java:156)
clojure.lang.Var.applyTo (Var.java:700)
clojure.main.main (main.java:37)
Ran 1 tests containing 1 assertions.
0 failures, 1 errors.
Tests failed.