一尘不染

如何配置jooq-sbt-plugin

sql

我是SBT的新手。我想在我的SBT配置中包含jooq-sbt-plugin(GitHub)。我正在使用Build.scala处理多个项目,我想在其中包含jooq-sbt-plugin配置,但是我不知道该放在哪里。

import sbt._
import Keys._

object SampleBuild extends Build {

    lazy val all = Project(id = "all", base = file("."), settings = defaultSettings) aggregate(
      one, two
    )

    lazy val one = Project(
        id = "one",
        base = file("one"),
        settings = defaultSettings ++ Seq(
            libraryDependencies ++= Dependencies.one
        )
    )

    lazy val two = Project(
        id = "two",
        base = file("two"),
        settings = defaultSettings ++ Seq(
            libraryDependencies ++= Dependencies.two
        )
    ) dependsOn (one)

    override lazy val settings = super.settings ++ buildSettings

    lazy val buildSettings = Seq(
        organization := "org.sample",
        version      := "0.1-SNAPSHOT",
        scalaVersion := "2.10.2"
    )

    lazy val defaultSettings = Defaults.defaultSettings ++ Seq(
        scalacOptions in Compile ++= scalacParams,
        externalResolvers in Compile := Resolvers.commonResolvers,
        shellPrompt  := ShellPrompt.buildShellPrompt,
        resolvers ++= Resolvers.commonResolvers
    )
}

object Resolvers { /* ... */ }

object Dependencies { /* ... */ }

object ShellPrompt { /* ... */ }

此外,我还向中添加了以下内容,plugins.sbt但是在jooq:codegen尝试运行该任务时找不到该任务。

// JOOQ plugin for SBT
resolvers += "sean8223 Releases" at "https://github.com/sean8223/repository/raw/master/releases"

addSbtPlugin("sean8223" %% "jooq-sbt-plugin" % "1.0")

我想要在项目中运行jOOQ插件one。我应该如何将此配置添加到Build.scala?非常感谢您的帮助。提前致谢!


阅读 133

收藏
2021-05-23

共1个答案

一尘不染

我不知道这个插件,但这应该可以工作:

import sbt._
import Keys._
import JOOQPlugin._

object SampleBuild extends Build {
  lazy val one = Project(
    id = "one",
    base = file("one"),
    settings = defaultSettings ++ jooqSettings ++ Seq(
      libraryDependencies ++= Dependencies.one,
      jooqOptions := Seq(...)
    )
  )

  ....
}
2021-05-23