如何添加一个钩子到uberjar过程(用lein建筑) [英] how to add a hook into the uberjar process (building with lein)

查看:209
本文介绍了如何添加一个钩子到uberjar过程(用lein建筑)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想添加一个钩子到uberjar过程。具体示例是将maxmind geoip dat文件下载到resources文件夹中,以便更新的版本在每次部署时捆绑到jar中。示例/建议感谢!

i would like to add a hook to the uberjar process. the specific example is to download the maxmind geoip dat file into the resources folder so an updated version is bundled into the jar every time it deploys. examples/suggestions appreciated thanks!

推荐答案

我建议自定义lein任务调用uberjar,而不是使用钩子。例如,如果你的项目被调用foo:

I recommend making a custom lein task that calls uberjar, rather than using a hook. For example, if your project is called foo:

file:foo / tasks / leiningen / foobuild.clj / p>

file: foo/tasks/leiningen/foobuild.clj

(ns leiningen.foobuild
  (:require leiningen.uberjar))

(defn foobuild [project]
  (download-maxmind-geoip-data)
  (leiningen.uberjar/uberjar project))

然后您可以使用以下命令运行:

Then you can run this with:

lein foobuild

这篇关于如何添加一个钩子到uberjar过程(用lein建筑)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆