I have a noob question about preparing libs to be :local/root source dependencies. I have such a lib, but I can't get the dependency to work because no matter what I do, clj still thinks the library has not been prepped. It is a tiny library consisting of one source file plus a couple of Maven deps on Commons IO and Clojure Data CSV. I have run clj -X:deps prep on this library, and that process added the expected required content to deps.edn, to wit: {:paths ["src" "target/classes"] :deps/prep-lib {:alias :build :fn compile :ensure "target/classes"}} I then go to another tiny project that specifies my library as a :local/root dependency and try to start it up, but I always get a classpath error that the lib is not prepped. What am I (probably) missing?
is there a target/classes in the dir?
No.
It was not clear to me how that should be created.
to translate {:alias :build :fn compile :ensure "target/classes"} into words...
if this project does not have "target/classes", run clj -T:build compile (which should put something in target/classes)
I would literally run the command in red?
you don't run it - prep will run it for you when you use it from another project
I mean, you can run it, and then it should appear prepped
Do I run prep while in the other project, as opposed to running it while in the library project dir?
yes
clj -X:deps prep means "prepare my deps to be on my classpath"
When I run the prep command in the other project, it complains that it doesn't know what compile is.
we may have run out of specific-enough information at this point
LOL - I would be happy to provide more specifics.
https://clojure.org/guides/deps_and_cli#prep_libs hopefully says that same stuff
It does, but not as explicitly. It was not clear to me which deps.edn would acquire those new entries and which dir I should be in when I ran the prep command, for instance.
Probably because I don't really understand what I am / it is doing.
that example has:
• needs-prep - a local lib that needs prepping. it has the :deps/prep-lib in its deps.edn
• cool-lib - a project using needs-prep, includes needs-prep as a :local/root dep. clj -X:deps prep is run here
I will give this another try based on that understanding. Thank you.
I can see why that example does not fully specify, will try to improve it
Great.
This is the error I get when I run prep in my equivalent of cool-lib: Prepping csvlib/core in /Users/alanbirchenough/clojure/csvlib Execution error (ExceptionInfo) at clojure.tools.deps/qualify-fn (deps.clj:654). Unqualified function can't be resolved: compile
@alexmiller Can you please suggest what I should do to diagnose this error, now that I appear to be executing the process correctly? Thanks.
I think I know what is causing this.
Closing the loop, then I'll shut up: Because I prepped while in my-lib instead of in cool-lib, I had a bogus reference to compile in my deps.edn.
so, working now?
Seems to be, thanks.
Thank you very much for your assistance with this process.
amazing, came to this channel to ask about this exactly, and the thread was right here ❤️ thank you!