我试图在目录结构中构建包含一些java源代码和clojure源代码的项目,如下所示:
src
`-- main
|-- clojure
| `-- appc
| `-- core.clj
`-- java
`-- appj
`-- AppStarter.java我已经在我的gradle构建文件中加载了java、clojure和application插件。Clojure插件来自https://bitbucket.org/kotarak/clojuresque/overview,版本1.5.2。
在这里,clojure代码core.clj有使用用java编写的类的代码。但是,java源代码中没有任何依赖于clojure代码的东西。
现在,当我做gradle tasks --all时,我看到了
...
classes - Assembles the main classes.
compileClojure - Compile the main Clojure source.
compileJava - Compiles the main Java source.
processResources - Processes the main resources.
...因此,build任务将首先编译我的clojure源代码,然后编译java源代码。这显然不起作用,因为clojure代码依赖于java部分。所以我需要compileJava发生在compileClojure之前。
更改应用clojure和java插件的顺序没有任何效果。
因为clojure插件是新的,所以我尝试了groovy和scala插件。我在每一件案子中都得到了以下信息。
...
classes - Assembles the main classes.
compileGroovy - Compile the main Groovy source.
compileJava - Compiles the main Java source.
processResources - Processes the main resources.
...和
...
classes - Assembles the main classes.
compileJava - Compiles the main Java source.
compileScala - Compile the main Scala source.
processResources - Processes the main resources.
...我想应该有办法重新安排这些,对吧?我在文档中找不到(尽管它们真的很好!)有没有办法让gradle先编译我的java源代码,然后编译clojure源代码?
发布于 2012-10-15 16:11:08
得到正确的订单就像compileClojure.dependsOn(compileJava)一样简单。另一个问题是,Java类是否正确地放置在Clojure编译器的类路径上。
PS:gradle tasks输出中的任务顺序与任务执行的顺序无关。任务执行的顺序完全由任务依赖关系决定。
https://stackoverflow.com/questions/12899185
复制相似问题