[GRADLE-1859] overwrite of compileJava task breaks java task ordering for multi-project builds Created: 21/Oct/11 Updated: 10/Feb/17 Resolved: 10/Feb/17 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 1.0-milestone-1, 1.0-milestone-2, 1.0-milestone-3 |
Fix Version/s: | None |
Type: | Bug | ||
Reporter: | Scott Yancey | Assignee: | Unassigned |
Resolution: | Won't Fix | Votes: | 2 |
Attachments: | gradle-test.zip |
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 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 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...
include 'project-child', 'project-parent'
subprojects { apply from: '<your_path>/override.gradle' }dependsOnChildren()
apply plugin: 'java' task compileJava(dependsOn: JavaPlugin.PROCESS_RESOURCES_TASK_NAME, overwrite: true, description: 'Compile Override') { }
dependencies { compile project(":project-parent") }
<no content> |
Comments |
Comment by Koen Ongena [ 03/May/12 ] |
A workaround: def projectDependencies = [project(':project-child')] dependencies { compile projectDependencies }Let it be noted though that I don't like this |
Comment by Alejandro Salas [ 18/Oct/12 ] |
I ran into the same problem for a lombok+aspectj build. Don't know if it's the correct way but I solved it using: In my case this did the trick: Hope it helps. |
Comment by Benjamin Muschko [ 15/Nov/16 ] |
As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub. We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to. Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:
We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle! |
Comment by Benjamin Muschko [ 10/Feb/17 ] |
Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved. |