Welcome! Please see the About page for a little more info on how this works.

0 votes
in Namespaces and vars by

Going through the intro tutorial with the suggested project structure.

├── time-lib
│   ├── deps.edn
│   └── src
│       └── hello_time.clj
└── hello-world
    ├── deps.edn
    └── src
        └── hello.clj

The file time-lib/hello-world/deps.edn is referencing :local/root as such: {:deps {time-lib/time-lib {:local/root "../time-lib"}}}

When I invoke clj -X hello/run
from the following directory: ~/projects/hello-world

Then my I get a result with the current time as expected.

However, if I go up a level and invoke the same command from: ~/projects/, then I receive an error:
`Namespace could not be loaded: hello

Is this really a failure to 'load' the namespace? In which case I would like to know how to enforce an absolute path onto :local/root, or is it a failure to find the hello.clj?

When I try and help clj to find the file by invoking clj -X hello-world/hello/run from the projects/` directory, I still get a namespace error.

I've checked some documentation, but it appears light on how this is supposed to work.

1 Answer

+1 vote
by

The Clojure CLI is dependent on the deps.edn in the current directory, so when you move to the root (~/projects), you no longer have a deps.edn and none of the projects will be on your classpath. You can use clj -Spath to look at the computed classpath to verify what's happening.

...