Search code examples
javaclojurejvmlispleiningen

No implementation of method: :as-file of protocol: #'clojure.java.io/Coercions found for class: java.lang.Character in leiningen project file


I'm trying to create a multi target project with leiningen so I have have it produce multiple different jar files and this is the project file I've created:

(defproject linuxmisc "0.1.0-SNAPSHOT"
    :main void.install

    :dependencies [
        [org.clojure/clojure "1.10.1"]]
    
    :resource-path "resources/"
    :target-path "output/%s"
    
    :jvm-opts ["-Dclojure.compiler.direct-linking=true"]
    
    :profiles {
        :void {
            :aot :all
            :main void.install
            :source-path "src/"}
        :nixos {
            :aot :all
            :main nixos.preinstall
            :source-path "src/"}
        :artix {
            :aot :all
            :main artix.preinstall
            :source-path "src/"}}
)

and it keeps returning errors and I can't figure out quite what's wrong with it


Solution

  • I don't see that error. My version with files:

     > tree
    .
    ├── project.clj
    ├── src
    │   └── demo
    │       └── core.clj
    └── test
        └── demo
            └── core_test.clj
    
    > cat project.clj 
    (defproject linuxmisc "0.1.0-SNAPSHOT"
      :main demo.core
      :dependencies [[org.clojure/clojure "1.10.1"]]
    
      :resource-path "resources/"
      :target-path "output/%s"
    
      :jvm-opts ["-Dclojure.compiler.direct-linking=true"]
    
      :profiles {
                 :void {
                        :aot :all
                        :main void.install
                        :source-path "src/"}
                 :nixos {
                         :aot :all
                         :main nixos.preinstall
                         :source-path "src/"}
                 :artix {
                         :aot :all
                         :main artix.preinstall
                         :source-path "src/"}}
    

    and code

    (ns demo.core
      )
    
    (defn -main
      "I don't do a whole lot ... yet."
      [& args]
      (println "-main - enter")
      )
    
    (ns demo.core-test
      (:use clojure.test))
    
    (deftest ttt
      (println "testing...")
      (is true))
    

    with results:

    > lein clean; lein run
    -main - enter
    
    
    > lein clean; lein test
    
    lein test demo.core-test
    testing...
    
    Ran 1 tests containing 1 assertions.
    0 failures, 0 errors.
    
    ``
    
    I'm guessing something weird is happening with your `void.install`, `nixos.preinstall`, or `artix.preinstall` items.  Those don't look like namespaces....?