I am using jOOQ . Solving the problem with the jooq-sbt-plugin
config ( here ) led to a classpath problem, which I think is separate from the original. I managed to set up the configuration, but trying to get it to play with the Oracle drivers seems impossible.
The problem here is that the plugin seems to start its own java
process, and therefore the required class path (with odbc14.jar
in it) is never passed. Is there any way to make the plugin work? I could not figure out how to enter the path to the plugin.
The only workaround I can come up with is to define a task instead (described here: https://gist.github.com/chris-martin/5140754 ).
Any help is appreciated. Thanks.
Update 2013-09-10
Here's the config:
import sbt._ import Keys._ import JOOQPlugin._ 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 ++ jooqSettings ++ customJooqSettings ++ 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 ) lazy val customJooqSettings = Seq( jooqOptions := jooqBvpOptions, jooqOutputDirectory := new java.io.File("../src/appdb/src/main/java") ) lazy val jooqBvpOptions = Seq( "jdbc.driver" -> "oracle.jdbc.OracleDriver", "jdbc.url" -> "jdbc:oracle:thin:@//<some server>", "jdbc.user" -> "<some user>", "jdbc.password" -> "<some pwd>", "generator.database.name" -> "org.jooq.util.oracle.OracleDatabase", "generator.database.inputSchema" -> "<some schema>", "generator.database.includes" -> "table1|table2|table3", "generator.target.packageName" -> "org.example.generated") } object Resolvers { } object Dependencies { } object ShellPrompt { }
And here is the error:
[info] Initialising properties : /jooq-config2705409947508036761.xml [error] Cannot read /jooq-config2705409947508036761.xml. Error : oracle.jdbc.OracleDriver [error] java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver [error] at java.net.URLClassLoader$1.run(URLClassLoader.java:202) [error] at java.security.AccessController.doPrivileged(Native Method) [error] at java.net.URLClassLoader.findClass(URLClassLoader.java:190) [error] at java.lang.ClassLoader.loadClass(ClassLoader.java:306) [error] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) [error] at java.lang.ClassLoader.loadClass(ClassLoader.java:247) [error] at java.lang.Class.forName0(Native Method) [error] at java.lang.Class.forName(Class.java:171) [error] at org.jooq.util.GenerationTool.main(GenerationTool.java:269) [error] at org.jooq.util.GenerationTool.main(GenerationTool.java:123) [error] Usage : GenerationTool <configuration-file> [trace] Stack trace suppressed: run last appdb-tool/jooq:codegen for the full output. [error] (appdb-tool/jooq:codegen) Failed with return code: 255 [error] Total time: 1 s, completed Sep 10, 2013 1:45:24 PM