Details
-
Type:
Bug
-
Status:
Open
-
Resolution: Unresolved
-
Affects Version/s: 1.0-milestone-1, 1.0-milestone-2, 1.0-milestone-3
-
Fix Version/s: None
Description
I have a reproducible test case showing that when the "compileJava" task is overwritten then the normal Java task dependencies for multi-project builds is broken. For example, if project "Child" depends on code produced by project "Parent," then project "Child" needs the jar produced by project "Parent" to be present before project "Child" is compiled. When the "compileJava" task is NOT overwritten, then you see the standard order of tasks for java-based multi-project dependencies:
:project-parent:compileJava
:project-parent:processResources
:project-parent:classes
:project-parent:jar
:project-child:compileJava
However, if you overwrite the "compileJava" task (real world use case for this is needing to use an aspectj compiler instead), then the ordering is broken as compilation of project "Child" occurs before the jar is built for project "Parent".
:project-child:processResources
:project-child:compileJava
:project-child:classes
:project-child:jar
:project-child:assemble
:project-parent:processResources
:project-parent:compileJava
:project-parent:classes
:project-parent:jar
Now obviously this will break a real compilation event when the overwritten "compileJava" task actually performs compilation instead of being stubbed out as in my test case. Regardless of what the contents of the overwritten "compileJava" task is, the order of multi-project Java dependencies should not change. I've added a zip of this test case to demonstrate. And I've pasted in the key files below...
-
- /settings.gradle
include 'project-child', 'project-parent'
-
- /build.gradle
subprojects { apply from: '<your_path>/override.gradle' }
dependsOnChildren()
-
- /override.gradle
apply plugin: 'java'
task compileJava(dependsOn: JavaPlugin.PROCESS_RESOURCES_TASK_NAME, overwrite: true, description: 'Compile Override') {
}
-
- /project-child/build.gradle
dependencies { compile project(":project-parent") }
-
- /project-parent/build.gradle
<no content>