所以,我有一个SBT项目,有两个自定义任务jooq:codegen
和flyway:migrate
来自[https://github.com/sean8223/jooq-sbt-plugin,https://github.com/sean8223/flyway-sbt-plugin]
此处并不相关,但flyway:migrate
任务在数据库中创建架构,jooq:codegen
从架构生成代码。因此,flyway:migrate
必须在jooq:codegen
之前运行。所以,我在build.sbt
(codegen in JOOQ) <<= (codegen in JOOQ) dependsOn (migrate in Flyway)
此外,compile
需要jooq:codegen
生成的代码,但默认情况下插件会处理它。
这是奇怪的部分。当我运行sbt compile
时,我得到:
~/N/p/d/davion git:data-access ❯❯❯ sbt compile
[info] Loading project definition from /Users/rohan/Nomadly/projects/davion-projects/davion/project
[info] Set current project to davion (in build file:/Users/rohan/Nomadly/projects/davion-projects/davion/)
[info] Done updating.
[info] Initialising properties : /jooq-config4460313300896426081.xml
... OUTPUT TRUNCATED ...
[info] Table records generated : Total: 669.172ms, +44.536ms
[info] Routines fetched : 0 (0 included, 0 excluded)
[info] Packages fetched : 0 (0 included, 0 excluded)
[info] GENERATION FINISHED! : Total: 688.254ms, +19.082ms
[info] Compiling 7 Scala sources and 17 Java sources to /Users/rohan/Nomadly/projects/davion-projects/davion/target/classes...
[success] Total time: 24 s, completed 14 May, 2015 12:13:35 PM
因此,flyway:migrate
任务不会运行。但是当我运行sbt jooq:codegen
时,会发生这种情况:
~/N/p/d/davion git:data-access ❯❯❯ sbt jooq:codegen
[info] Loading project definition from /Users/rohan/Nomadly/projects/davion-projects/davion/project
[info] Set current project to davion (in build file:/Users/rohan/Nomadly/projects/davion-projects/davion/)
[info] Flyway (Command-line Tool) v.2.0.3
[info]
[info] Current schema version: 6
[info] Schema is up to date. No migration necessary.
[info] Initialising properties : /jooq-config6431105742854017589.xml
[info] License parameters
... OUTPUT TRUNCATED ...
我不知道为什么会这样。如果设置了一个任务链,其中&#39; A&#39;取决于&#39; B&#39;这取决于C&#39;然后不应该运行&#39; A&#39;执行&#39; C&#39;和&#39; B&#39; (并按此顺序)?为什么&#39; C&#39;不作为传递依赖运行,我该如何解决这个问题呢?