venantius / vim-cljfmt

A Vim plugin for cljfmt, the Clojure formatting tool.
152 stars 22 forks source link

cljfmt/core.clj not found exception #3

Closed joelash closed 9 years ago

joelash commented 9 years ago

When I run :Cljfmt I get the following error:

FileNotFoundException Could not locate cljfmt/core__init.class or cljfmt/core.clj on classpath:   clojure.lang.RT.load (RT.java:443)

I'm ensured that I can run lein cljfmt check src/foo/bar/file.clj from the command line. To mean that means that I've satisfied this sentence from your Readme.md

, and you'll need to make sure cljfmt is somewhere on the Leiningen classpath

What would be causing this. I've tried added [lein-cljfmt "0.1.5"] (note 0.1.6 was released today but isn't available on clojars yet) under :plugins in both my project.clj and in my ~/.lein/profiles.clj.

venantius commented 9 years ago

That is really interesting. I agree, you should have satisfied the requirements.

When you do lein repl, are you able to (require 'cljfmt.core)?

joelash commented 9 years ago

OK some "progress" has been made.

I moved to having [cljfmt "0.1.5"] in the :dependencies section of my ~/.lein/profiles.clj. This causes the exception to no longer happen. However, it appears that nothing happens when I do run :Cljfmt.

Another thing to note is that I'm actually starting a REPL as part of running my application and then using fireplace to connect to it.

venantius commented 9 years ago
  1. How are you initializing your application?
  2. Are you able to execute the require command for cljmft over the Fireplace repl?
call fireplace#session_eval("(require 'cljfmt.core)")
joelash commented 9 years ago
  1. In development I'm just using lein run
  2. That was also appearing to do nothing.

This time when I quit vim and restarted it, I would get eastwood errors when I tried to open my clj file, causing vim to crash. When I commented out the Bundle 'venantius/vim-eastwood' from my ~/.vimrc I was able to successfully run :Cljfmt

venantius commented 9 years ago

Well, so long as requiring cljfmt.core wasn't throwing an exception, "doing nothing" would be the expected behavior.

I'm going to say that this issue is resolved, but that it sounds like there is an issue with vim-eastwood. Mind filing an issue there?

joelash commented 9 years ago

I will shortly, let me make sure it's not user error first. Thanks for your help

sushovannits commented 5 years ago

I am still having a similar issue. I have added the dependency in ~/.lein/profiles.clj but I cannot (require 'cljfmt.core)(It says: java.io.FileNotFoundException: Could not locate cljfmt/core__init.class or cljfmt/core.clj on classpath.).

However as suggested if I add cljfmt to dependencies in project then it works. However I do not want to add it in dependency

venantius commented 5 years ago

@sushovannits could you paste your ~/.lein/profiles.clj?

sushovannits commented 5 years ago

@venantius

{:repl {:plugins [[cider/cider-nrepl "0.18.0-SNAPSHOT"]
                  [lein-cljfmt "0.5.6"]]
        :dependencies [[org.clojure/tools.nrepl "0.2.13"]
                       [lein-cljfmt "0.5.6"]]}}
{:user {:plugins [[cider/cider-nrepl "0.8.1"]
                  [lein-cljfmt "0.5.6"]]
        :dependencies [[lein-cljfmt "0.5.6"]]}}
venantius commented 5 years ago

@sushovannits your problem is that you have the plugin in your dependencies. cljfmt has both a plugin jar and a dependency jar. The dependency jar is just [cljfmt "0.6.3"]