Fork me on GitHub
#leiningen
<
2017-10-09
>
djjolicoeur14:10:14

any lein plugin experts? eval-in-project should use the classpath of the project passed in, right?

danielcompton18:10:16

Yep, what’s the issue?

djjolicoeur19:10:02

@danielcompton I have a witten a plugin using eval-in-project. I am expecting datomic to be present on the classpath of the project, and it is on the project I am testing the plugin on. When I add the plugin to :plugins, all calls to lein fail with a compiler error about not being able to find datomic.api__init.class or datomic/api.clj. datomic is on the classpath, and indeed if I remove the plugin the target app starts up fine with datomic.

danielcompton19:10:04

have you required datomic.api in the namespace that your plugin is evaling into?

danielcompton19:10:38

also, if you add datomic to :plugins it will be on Leiningen's classpath. Does that fix it? Not a long term solution, but good to check exactly where the issue is coming from

djjolicoeur19:10:56

datomic.api is required by a namespace that is required in the plugin namespace. The plugin is added to both the projects deps and plugins as it has components that one would want to use from the repl say and others that are best used as a plugin. I find it interesting that it fails on any call to lein though, calls not related to my plugin. that means the forms inside the eval-in-project must be getting evaluated, is that expected? datomic.api only gets pulled in via the require in the setup arg to eval-in-project https://github.com/djjolicoeur/datomap/blob/stash-dot-tables/src/leiningen/datomap.clj#L6

djjolicoeur19:10:54

I will give the second idea about adding datomic to the plugins a shot, I am unfortunately not able to do so at the moment, though

danielcompton19:10:30

I wonder if the require is being run in the lein project, not your one

djjolicoeur19:10:39

ha I actually have tried using one form like that. thats actually the last thing I tried before trying to reach out.

djjolicoeur20:10:57

I think you are on to something with it being run from inside the lein project, I just added (require 'datomic.api) directly to the plugin code and that does not fail before that require I had there before, so I think it is failing to compile before it even gets there. not sure why that would be the case, though as datomic is on the classpath

djjolicoeur20:10:29

not sure how to get around that, or why that would be the case for that matter. this project https://github.com/felixflores/datomic_schema_grapher does very much the same things and works fine from the same project.