【问题标题】:Can Datomic dev-local be installed on windows?Datomic dev-local 可以安装在 Windows 上吗?
【发布时间】:2021-03-01 15:59:59
【问题描述】:

我正在尝试在 Windows 10 计算机上安装 Datomic,遵循official instructions

downloaded 并按照说明解压缩了开发工具。

但是,我无法运行安装脚本,因为它是一个 bash 脚本。

我打开脚本发现它需要 maven,所以我安装了 maven 并尝试手动运行命令。

echo 'Installing: com.cognitect/rebl {:mvn/version "0.9.242"}'
mvn -q org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dfile=rebl-0.9.242/rebl-0.9.242.jar
echo 'Installing: com.datomic/dev-local {:mvn/version "0.9.232"}'
mvn -q org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dfile=dev-local-0.9.232/dev-local-0.9.232.jar

起初这是错误的

你指定的目标需要一个项目来执行但是这个目录下没有POM

所以我想出了如何创建一个 maven pom.xml。

然后出错

[ERROR] The specified file 'C:\workspaces\clj-recipe\rebl-0' not exists
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file (default-cli) on project clj-recipe: The specified file 'C:\workspaces\clj-recipe\rebl-0' not exists

dev-local 不是为 Windows 设计的吗?

更新

我确实运行了 maven 脚本。我在 dev 工具目录下创建了自己的 install.ps1,路径保持不变,并引用了文件路径。

# expects to be run from the project (pom.xml) directory, but in a script file in the same directory as the original install script

echo 'Installing: com.cognitect/rebl {:mvn/version "0.9.242"}'
mvn -q org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dfile="rebl-0.9.242/rebl-0.9.242.jar"
echo 'Installing: com.datomic/dev-local {:mvn/version "0.9.232"}'
mvn -q org.apache.maven.plugins:maven-install-plugin:3.0.0-M1:install-file -Dfile="dev-local-0.9.232/dev-local-0.9.232.jar"

我仍然无法让 dev-local 运行。 pom.xml 似乎没有变化。 我为当前的 le​​in 项目启动了一个 repl 并运行

(require '[datomic.client.api :as d])
(def client (d/client {:server-type :dev-local
                       :system "dev"}))

收到错误No such namespace: d

我的猜测是我不明白 deps.edn 是如何工作的......现在我在 C:/Users/[username here]/documents/.clojure/deps.edn 下有一个 deps.edn

{
:mvn/repos {"cognitect-dev-tools"
             {:url "https://dev-tools.cognitect.com/maven/releases/"}}

:deps
{com.datomic/dev-local {:mvn/version "0.9.225"}}
}

【问题讨论】:

  • 虽然您可能会在这里得到答案,但ask.datomic.com 至少是 Datomic 的一个官方支持渠道。
  • 在 Windows 上运行的最佳方式是安装 Git Bash。即使您不需要 Git 部分,它也可以在 Windows 上为您提供一个不错的 Linux 和 Bash 仿真:git-scm.com/downloads

标签: windows installation clojure datomic


【解决方案1】:

这里有两个关键问题

  1. leiningen 不需要安装脚本(也不是为 Windows 编写的)
    • 如果您想使用基于 maven 的方法,请使用安装脚本。请注意,您需要安装 maven。
    • 可以通过如上所示的更改(引用路径、删除 cd、使其成为 ps1 文件)来针对 Windows 调整安装脚本
  2. deps.edn、maven 和 leiningen 路径不兼容。我必须使用 leiningen 配置依赖项才能在基于 lein 的项目中使用它

为 lein 配置相当简单

  • 添加存储库配置部分
  • 添加包依赖
(defproject ;;...
  :dependencies [
                 ;;...
                 [com.datomic/dev-local "0.9.225"]
                 ]
  :repositories [
                 ["cognitect-dev-tools" {:url      "https://dev-tools.cognitect.com/maven/releases/"
                                         :username :env/datomic_username
                                         :password :env/datomic_password}]]
;;...  
)

请注意,必须将凭据提供给 lein 项目。这可以通过

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-18
    • 2010-12-15
    • 1970-01-01
    • 1970-01-01
    • 2012-07-18
    相关资源
    最近更新 更多