我正在尝试在如下目录结构中构建具有一些 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
andscala
插件。在每种情况下,我都得到了以下信息。
...
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 源代码?