Gradle dependsOn and overwrite

xcv58
xcv58’s blog
Published in
1 min readAug 31, 2015

--

I’m working on a project that need a custom Java compiler. Our compiler is an ordinary Java program, which should use java to start compiler instead of javac.

For gradle support, we decide replace all tasks with type JavaCompile to our custom JavaExec tasks. But we found a conflict between overwrite and dependsOn. The gist below with comments show which style can get expected outputs.

The weird thing is that the dosen’t work codes is not actually doesn’t work. In my previous experiments, it works (overwrite task a appear) sometimes, doesn’t work (task a appear) sometimes. Unfortunately, I can’t recreate this inconsistent issue.

--

--