简体   繁体   English

将leiningen.new.templates命名空间添加为项目中的依赖项

[英]Add leiningen.new.templates namespace as a dependency in project

Is it feasible to add only this one Leiningen namespace as a dependency in a project (standard project and not lein template)? 在项目(标准项目而不是lein模板)中仅添加一个Leiningen名称空间作为依赖项是否可行? I found this namespace is originated from lein-newnew (now deprecated) which means at one time this was possible. 我发现此命名空间源自lein-newnew (现已弃用),这意味着有可能一次实现。

I know that I could use whole Leiningen as a dependency and refer only those namespaces that are needed but it doesn't look so optimal - whole Leiningen would be packed in uberjar and I need just few functions from a namespace. 我知道我可以将整个Leiningen用作依赖项,并且仅引用所需的那些名称空间,但它看起来并不是那么理想-整个Leiningen将被打包在uberjar中,而我只需要名称空间中的几个函数。

As far as I know, there is no way to just import a namespace from a project (ex. from clojars, maven etc.). 据我所知,没有办法仅从项目(例如,从clojars,maven等)导入名称空间。 It would probably be quite a bit of trouble (think about dependencies, eventual configuration, the namespace may not even be part of the public api...). 这可能会带来很多麻烦(考虑依赖项,最终配置,名称空间甚至可能都不是公共api的一部分...)。

So I would either : 所以我会:

  • depend on the whole other project, fortunately in your case you can depend on leiningen-core 取决于整个其他项目,幸运的是,您可以依靠leiningen-core
  • copy-paste the code into your project (assuming the respective licences allow it of course). 将代码复制粘贴到您的项目中(当然,假设相应的许可证允许这样做)。 This has the added benefit that you will be able to modify it to suit your needs. 这具有额外的好处,您将能够对其进行修改以适合您的需求。

You can actually see an example of this "in the wild", in the boot-new repository. 实际上,您可以在boot-newboot-new存储库中看到“狂野”的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM