Leiningen: How to exec something before dependency resolving

Buildtool: Leiningen
IDE: IntelliJ + Cursive

I’m trying to handle following scenario: Whenever I’m importing a leiningen project in Intellij the Cursive/Leiningen plugin syncs the project automatically and tries to resolve missing dependencies. Some of them are located in an AWS S3 bucket, which need credentials. If my session-token is out of date the dependency resolution fails.

I’m trying to hook into the leiningen build process to check beforehand if my session token is still valid, otherwise the sync/leiningen task should fail and not even attempt to download these artifacts with invalid credentials.
I tried defining the check in :prep-tasks in my user profile but the dependency resolution seems to take place before nonetheless.

Do you have an idea, how I could tackle this? Thanks in advance :slight_smile:

Any pointer in the right direction?

Extending lein is quite annoying. It used to support hooks, but are since deprecated though I think they can still be used.

You can read all about it here: https://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md

Hi, thanks for your answer. Yeah, seems kinda annoying.
The more I think about it, I believe that relying on any given build tool (leiningen in this case) might not be the best solution for what I’m trying to achieve.
As we are using multiple programming languages and build tools, I would have to implement “checking for valid aws session token” for all of them (gradle, leiningen, sbt). Maybe I might just write a cron job that gets a fresh token on a regular basis. Thanks for your input.