Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure jooq-sbt-plugin

I'm relatively new to SBT. I'd like to include the jooq-sbt-plugin (GitHub) in my SBT config. I'm using Build.scala to handle multiple projects and I'd like to include the jooq-sbt-plugin config there but I couldn't figure out where to put it.

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 { /* ... */ }

Also, I've added the following to the plugins.sbt but the task jooq:codegen is not found when I try to run it.

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

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

What I'd like is to run the jOOQ plugin with the project one. How should I add this config to my Build.scala? Help is greatly appreciated. Thanks in advance!

like image 459
mkko Avatar asked Nov 02 '22 16:11

mkko


1 Answers

I don't know about this plugin, but this should work:

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

  ....
}
like image 79
Eugene Yokota Avatar answered Nov 15 '22 06:11

Eugene Yokota