如何修复错误“不允许删除非目标项目路径[”test-app / renderer / renderer.js%s“]。”清洁我的项目时?

时间:2017-06-28 17:01:25

标签: clojure leiningen

当我运行lein clean时,我收到此错误:

Deleting non-target project paths ["test-app/renderer/renderer.js%s"] is not allowed.

什么使路径成为目标项目路径?如何使路径成为目标项目路径?我的project.clj看起来像这样:

(defproject tech.projectx/clients "0.1.0-SNAPSHOT"
  :cljsbuild {:builds {:renderer      {:source-paths ["src/renderer" "src/common"]
                                       :compiler     {:output-to     "app/renderer/renderer.js"
                                                      :output-dir    "app/renderer"
                                                      :asset-path    "renderer"
                                                      :main          configurator.core
                                                      :language-in   :ecmascript5
                                                      :optimizations :none}}
                       :main          {:source-paths ["src/main" "src/common"]
                                       :compiler     {:output-to     "app/main/main.js"
                                                      :output-dir    "app/main"
                                                      :asset-path    "main"
                                                      :main          tech.projectx.main
                                                      :target        :nodejs
                                                      :externs       ["node_modules/closurecompiler-externs/path.js"
                                                                      "node_modules/closurecompiler-externs/process.js"]
                                                      :optimizations :simple}} ; without this, the packed application doesn't work.
                       :renderer-test {:source-paths ["src/renderer" "src/common" "test/renderer"]
                                       :compiler     {:output-to            "test-app/renderer/renderer.js"
                                                      :output-dir           "test-app/renderer"
                                                      :asset-path           "renderer"
                                                      :main                 clientcommon.test-runner
                                                      :language-in          :ecmascript5
                                                      :optimizations        :none
                                                      :source-map           true
                                                      :source-map-timestamp true
                                                      :pretty-print         true}
                                       :figwheel     {:websocket-host "localhost"
                                                      :on-jsload      "clientcommon.test-runner/run-all-tests"}}
                       :test-app-main {:source-paths ["test/main" "src/main" "src/common"]
                                       :compiler     {:output-to            "test-app/main/main.js"
                                                      :output-dir           "test-app/main"
                                                      :asset-path           "main"
                                                      :main                 tech.projectx.test-app-main
                                                      :target               :nodejs
                                                      :externs              ["node_modules/closurecompiler-externs/path.js"
                                                                             "node_modules/closurecompiler-externs/process.js"]
                                                      :optimizations        :none
                                                      :source-map           true
                                                      :source-map-timestamp true
                                                      :pretty-print         true}}}}

  :sass {:source-paths ["src/renderer/assets"]
         :target-path  "app/renderer/assets"
         :source-map   true}

  :figwheel {:server-logfile "log/figwheel-logfile.log"
             :css-dirs       ["app/renderer/assets"]}


  :clean-targets [[:cljsbuild :builds :renderer :compiler :output-to]
                  [:cljsbuild :builds :renderer :compiler :output-dir]
                  [:cljsbuild :builds :main :compiler :output-to]
                  [:cljsbuild :builds :main :compiler :output-dir]
                  [:cljsbuild :builds :renderer-test :compiler :output-to]
                  [:cljsbuild :builds :renderer-test :compiler :output-dir]
                  [:cljsbuild :builds :test-app-main :compiler :output-to]
                  [:cljsbuild :builds :test-app-main :compiler :output-dir]
                  "dist"]

  :profiles {:dev  {:cljsbuild {:builds {:renderer {:compiler {:source-map           true
                                                               :source-map-timestamp true
                                                               :pretty-print         true}
                                                    :figwheel {:websocket-host "localhost"
                                                               :on-jsload      "configurator.core/mount-root"}}
                                         :main     {:compiler {:source-map           "app/main/main.js.map"
                                                               :source-map-timestamp true
                                                               :pretty-print         true}}}}}
             :prod {:cljsbuild {:builds {:renderer {:compiler {:optimizations   :simple
                                                               :closure-defines {goog.DEBUG false}}}
                                         :main     {:compiler {:optimizations   :simple
                                                               :closure-defines {goog.DEBUG false}}}}}}})

1 个答案:

答案 0 :(得分:2)

它是一种内置的安全机制,可以防止意外删除不需要的东西(例如在项目目录之外等)。如果您仍想继续进行清理,请修改您的project.clj:

:clean-targets ^{:protect false} [....]

有关详细信息,请查看此来源中的完整性检查 protected-paths 函数:https://github.com/technomancy/leiningen/blob/master/src/leiningen/clean.clj