Clojure в Intelij IDEA - PullRequest
       32

Clojure в Intelij IDEA

0 голосов
/ 13 апреля 2019

Я открыл проект Clojure в Intelij IDEA, и все работало хорошо, пока я не создал новое рабочее пространство Clojure и не написал в нем некоторый код Clojure.Когда я пытаюсь выполнить этот фрагмент кода в REPL, я всегда получаю одну и ту же ошибку.Что бы я ни писал, я получаю ту же ошибку.Например, когда я пытаюсь выполнить (+ 1 1_, я получаю следующую ошибку:

Syntax error compiling at (test.clj:4:1).
Unable to resolve symbol: + in this context

Кто-нибудь уже сталкивался с этой проблемой?

Вот мой проект. Clj

(defproject test-app "0.1.0-SNAPSHOT"

  :description "FIXME: write description"
  :url "http://example.com/FIXME"

  :dependencies [[cheshire "5.8.1"]
                 [clojure.java-time "0.3.2"]
                 [cprop "0.1.13"]
                 [funcool/struct "1.3.0"]
                 [luminus-immutant "0.2.5"]
                 [luminus-transit "0.1.1"]
                 [luminus/ring-ttl-session "0.3.2"]
                 [markdown-clj "1.0.7"]
                 [metosin/muuntaja "0.6.4"]
                 [metosin/reitit "0.3.1"]
                 [metosin/ring-http-response "0.9.1"]
                 [mount "0.1.16"]
                 [nrepl "0.6.0"]
                 [org.clojure/clojure "1.10.0"]
                 [org.clojure/tools.cli "0.4.2"]
                 [org.clojure/tools.logging "0.4.1"]
                 [org.webjars.npm/bulma "0.7.4"]
                 [org.webjars.npm/material-icons "0.3.0"]
                 [org.webjars/webjars-locator "0.36"]
                 [org.webjars/webjars-locator-jboss-vfs "0.1.0"]
                 [ring-webjars "0.2.0"]
                 [ring/ring-core "1.7.1"]
                 [ring/ring-defaults "0.3.2"]
                 [selmer "1.12.12"]]

  :min-lein-version "2.0.0"

  :source-paths ["src/clj"]
  :test-paths ["test/clj"]
  :resource-paths ["resources"]
  :target-path "target/%s/"
  :main ^:skip-aot test-app.core

  :plugins [[lein-immutant "2.1.0"]]

  :profiles
  {:uberjar {:omit-source true
             :aot :all
             :uberjar-name "test-app.jar"
             :source-paths ["env/prod/clj"]
             :resource-paths ["env/prod/resources"]}

   :dev           [:project/dev :profiles/dev]
   :test          [:project/dev :project/test :profiles/test]

   :project/dev  {:jvm-opts ["-Dconf=dev-config.edn"]
                  :dependencies [[expound "0.7.2"]
                                 [pjstadig/humane-test-output "0.9.0"]
                                 [prone "1.6.1"]
                                 [ring/ring-devel "1.7.1"]
                                 [ring/ring-mock "0.3.2"]]
                  :plugins      [[com.jakemccrary/lein-test-refresh "0.24.1"]]

                  :source-paths ["env/dev/clj"]
                  :resource-paths ["env/dev/resources"]
                  :repl-options {:init-ns user}
                  :injections [(require 'pjstadig.humane-test-output)
                               (pjstadig.humane-test-output/activate!)]}
   :project/test {:jvm-opts ["-Dconf=test-config.edn"]
                  :resource-paths ["env/test/resources"]}
   :profiles/dev {}
   :profiles/test {}})

Все отлично работает, когда я пишу код в моем пространстве имен test-app.routes.home, но когда я создаю новое пространство имен Clojure test.clj в той же папке маршрутов, я не могу оценить код в REPL. Когда я нажимаю ctrl +Введите я получаю эту ошибку:

Syntax error compiling at (test.clj:4:1).
Unable to resolve symbol: + in this context

1 Ответ

0 голосов
/ 18 апреля 2019

(Может быть) Вам нужно оценить ваше пространство имен (ns ....), прежде чем пытаться вычислить любое другое выражение.

...