【发布时间】:2021-07-11 13:06:02
【问题描述】:
我正在尝试创建一个相对简单的 sbt 插件来包装 grpc-swagger 工件。 因此,我创建了一个具有以下结构的项目:
projectDir/
build.sbt
lib/grpc-swagger.jar <- the artifact I've downloaded
src/...
build.sbt 如下所示:
ThisBuild / version := "0.0.1-SNAPSHOT"
ThisBuild / organization := "org.testPlugin"
ThisBuild / organizationName := "testPlugin"
lazy val root = (project in file("."))
.enable(SbtPlugin)
.settings(name := "grpc-swagger-test-plugin")
根据sbt docs,这就是我要包含非托管依赖项所要做的一切,即:
- 创建一个
lib文件夹; - 将工件存放在那里;
但是,当我执行 sbt compile publishLocal 时,发布的插件缺少该外部工件。
到目前为止,我已经尝试过:
- 设置
exportJars := true标志 - 添加
Compile / unmanagedJars += file(lib/grpc-swagger.jar")(还有路径的变体) - 使用
from file("lib/grpc-swagger.jar")说明符手动修改libraryDependecies
但到目前为止似乎没有任何效果。
那么我应该如何将外部工件添加到 sbt 插件?
【问题讨论】:
标签: scala sbt sbt-plugin