Gradle

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
To raise new issues or bugs against Gradle, please use forums.gradle.org.
  • Gradle
  • GRADLE-1859

overwrite of compileJava task breaks java task ordering for multi-project builds

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Open 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...

    1. /settings.gradle

include 'project-child', 'project-parent'

    1. /build.gradle

subprojects { apply from: '<your_path>/override.gradle' }

dependsOnChildren()

    1. /override.gradle

apply plugin: 'java'

task compileJava(dependsOn: JavaPlugin.PROCESS_RESOURCES_TASK_NAME, overwrite: true, description: 'Compile Override') {

}

    1. /project-child/build.gradle

dependencies { compile project(":project-parent") }

    1. /project-parent/build.gradle

<no content>

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Hide
    Zip Archive
    gradle-test.zip
    21/Oct/11 7:38 PM
    42 kB
    Scott Yancey
    1. File
      gradle-test/rungradle 1 kB
    2. File
      gradle-test/settings.gradle 0.0 kB
    3. File
      gradle-test/build.gradle 0.1 kB
    4. File
      gradle-test/override.gradle 0.1 kB
    5. File
      gradle-test/project-child/build.gradle 0.1 kB
    6. File
      gradle-test/project-parent/build.gradle 0.0 kB
    7. Java Archive File
      gradle-test/.../project-child-1.0.jar 0.3 kB
    8. Java Archive File
      gradle-test/.../project-parent-1.0.jar 0.3 kB
    9. File
      gradle-test/.gradle/.../cache.properties 0.0 kB
    10. File
      gradle-test/.gradle/.../cache.bin 49 kB
    11. Java Source File
      gradle-test/project-child/.../ChildB.java 0.2 kB
    12. File
      gradle-test/.../css3-pie-1.0beta3.htc 31 kB
    13. File
      gradle-test/project-child/.../report.js 3 kB
    14. File
      gradle-test/project-child/.../style.css 3 kB
    15. HTML File
      gradle-test/project-child/.../index.html 1 kB
    16. File
      gradle-test/project-child/.../MANIFEST.MF 0.0 kB
    17. File
      gradle-test/.../css3-pie-1.0beta3.htc 31 kB
    18. File
      gradle-test/project-parent/.../report.js 3 kB
    19. File
      gradle-test/project-parent/.../style.css 3 kB
    20. HTML File
      gradle-test/project-parent/.../index.html 1 kB
    21. File
      gradle-test/project-parent/.../MANIFEST.MF 0.0 kB
    22. Java Source File
      gradle-test/project-parent/.../ParentA.java 0.1 kB
    Download Zip
    Show
    Zip Archive
    gradle-test.zip
    21/Oct/11 7:38 PM
    42 kB
    Scott Yancey

Activity

  • All
  • Comments
  • History
  • Activity
  • TeamCity
  • Commits
  • Source
  • Reviews

People

  • Assignee:
    Unassigned
    Reporter:
    Scott Yancey
Vote (2)
Watch (3)

Dates

  • Created:
    21/Oct/11 7:38 PM
    Updated:
    18/Oct/12 4:43 PM
  • Atlassian JIRA (v5.0.3#729-sha1:bf569e4)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Gradle. Try JIRA - bug tracking software for your team.