windows - Datomic dev-local 可以安装在 Windows 上吗?
问题描述
我正在尝试按照官方说明在 Windows 10 计算机上安装 Datomic 。
我按照说明下载并解压缩了开发工具。
但是,我不能运行安装脚本,因为它是一个 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 脚本运行。我在开发工具目录中创建了自己的 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 似乎没有变化。我为当前的 lein 项目启动了一个 repl 并运行
(require '[datomic.client.api :as d])
(def client (d/client {:server-type :dev-local
:system "dev"}))
得到错误No such namespace: d
。
我的猜测是我不明白 deps.edn 是如何工作的......现在我在下面有一个 deps.ednC:/Users/[username here]/documents/.clojure/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"}}
}
解决方案
这里有两个关键问题
- leiningen 不需要安装脚本(并且不是为 Windows 编写的)
- 如果您想使用基于 maven 的方法,请使用安装脚本。请注意,您需要安装 Maven。
- 安装脚本可以通过如上所示的更改(引用路径,删除 cd,使其成为 ps1 文件)针对 Windows 进行调整
- 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 项目。这可以通过
推荐阅读
- hadoop - hdfs 删除正在写入的文件
- javascript - 如何将用户输入的日期时间转换为 UTC 并在 Javascript 中使用远程服务器存储在数据库中
- javascript - allowEdit 属性不适用于 Cordova 应用程序中的 iOS 相机
- docker - 如何正确连接docker中的工作节点?
- ios - 将数据保存在特定用户 ID iOS - Alamofire, Json
- azure - 在 Microsoft Azure 中托管的网站上使用 Google Analytics
- angular - Angular 和 Iframe 不会重定向正确的窗口
- javascript - 添加事件侦听器后的javascript发出调用函数
- javascript - 当单击按钮移动到另一个 html 并显示层
- javascript - Highcharts series.data 不适合我