当只有插件的源可用时,如何在 sbt 项目中使用插件? [英] How to use plugin in sbt project when only the plugin's sources available?

查看:21
本文介绍了当只有插件的源可用时,如何在 sbt 项目中使用插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 sbt-scrooge 插件,但它的 repo 现在不可用 - http://koofr.github.com/.

I want to use the sbt-scrooge plugin, but its repo is unavailable now - http://koofr.github.com/.

我想我会将这个插件的源代码直接包含在我自己的仓库中(作为 git 子模块).

I thought I'd include this plugin's source code directly in my own repo (as a git submodule).

我试过了:

git submodule add https://github.com/bancek/sbt-scrooge.git project/sbt-scrooge

并添加:

addSbtPlugin("net.koofr" % "sbt-scrooge" % "3.0.45")

project/plugins.sbt.但它不起作用 - 抛出以下异常:

to project/plugins.sbt. But it doesn't work - the following exception is thrown:

sbt.ResolveException:未解析的依赖项:net.koofr#sbt-scrooge;3.0.45:未找到

sbt.ResolveException: unresolved dependency: net.koofr#sbt-scrooge;3.0.45: not found

正确的做法是什么?

我知道我可以将 sbt-scrooge 检出到本地文件系统,然后 sbt publish-local,并将本地 ivy2 存储库添加到 sbt 作为解析器.但我只想知道是否有其他方法可以做到这一点.

I know that I could checkout sbt-scrooge to the local filesystem, then sbt publish-local, and add the local ivy2 repo to sbt as a resolver. But I just want to know whether there are other ways to do this.

推荐答案

如解释 在这里你可以把它放在你的project/plugins.sbt中:

As explained here you can puth this in your project/plugins.sbt:

lazy val root = project.in(file(".")).dependsOn(scroogePlugin) 

lazy val scroogePlugin = file("sbt-scrooge") 

或者简单地(不创建本地子模块):

Or simply (without creating a local submodule):

lazy val root = project.in(file(".")).dependsOn(scroogePlugin) 

lazy val scroogePlugin = uri("https://github.com/bancek/sbt-scrooge.git") 

这篇关于当只有插件的源可用时,如何在 sbt 项目中使用插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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