Tim Clemons
Tim Clemons

Reputation: 6431

How to access leiningen properties from within the project.clj file

For the particular build I'm working on I need to make a call to an external command-line app using the lein-shell plugin. When invoking the shell command I'd like to pass in the artifact-id and version properties that I've defined in defproject to keep the resulting artifacts the app creates consistent.

In Maven I would use the ${artifactId} and ${version} properties to accomplish this. Is there analogous functionality in Leiningen?

Upvotes: 3

Views: 523

Answers (1)

Alex
Alex

Reputation: 13941

I don't know of anything that gives you this functionality out of the box, but it's pretty straightforward to write some custom middleware to transform the project map before it gets handed off to the shell task. You could hard-wire the properties in question, or get fancy and walk the project map and do the template subtitution you describe in a more general fashion. See the plugins documentation for more information about writing middleware.

Upvotes: 1

Related Questions