如何配置jooq-sbt-plugin

时间:2013-08-20 07:37:50

标签: sql scala sbt jooq jooq-sbt-plugin

我对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")

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

1 个答案:

答案 0 :(得分:2)

我不知道这个插件,但这应该有效:

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(...)
    )
  )

  ....
}