farlee2121
farlee2121

Reputation: 3367

Can Datomic dev-local be installed on windows?

I'm trying to install Datomic on a Windows 10 computer, following the official instructions.

I downloaded and unzipped the dev tools as instructed.

I cannot, however, run the install script because it is a bash script.

I opened the script and discovered it requires maven, so I installed maven and tried to run the commands manually.

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

At first this errored with

The goal you specified requires a project to execute but there is no POM in this directory

So I figured out how to create a maven pom.xml.

Then it errors

[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

Is dev-local not intended for windows?

Update

I did get the maven scripts to run. I created my own install.ps1 in the dev tool directory, which kept paths the same, and quoted the file paths.

# 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"

I still can't get dev-local to run though. There appears to be no changes to the pom.xml. I start up a repl for the current lein project and run

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

Getting the error No such namespace: d.

My guess is that I don't understand how deps.edn works... Right now I have a single deps.edn under C:/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"}}
}

Upvotes: 2

Views: 513

Answers (1)

farlee2121
farlee2121

Reputation: 3367

There were two key issues here

  1. The install script is not necessary with leiningen (and is not written for windows)
    • If you want to use a maven-based approach, then use the install script. Be warned that you need maven installed.
    • The install script can be tweaked for windows by changing as shown above (quote paths, remove the cd, make it a ps1 file)
  2. The deps.edn, maven, and leiningen paths are not compatible. I must configure the dependency using leiningen to use it in my lein-based project

Configuring for lein is fairly simple

  • add a repositories configuration section
  • add a package dependency
(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}]]
;;...  
)

Note that the credentials have to be supplied to the lein project. This can be done with

Upvotes: 3

Related Questions