Uploaded image for project: 'Gradle'
  1. Gradle
  2. GRADLE-771

Handle name clashes between Gradle tasks and imported Ant targets

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.2-rc-1

      Description

      a typical migration scenario of your Ant Java project starts with build.gradle looking like this:
      ant.importBuild 'build.xml'
      usePlugin 'java'

      it will probably fail because of name clash of tasks from build.xml and those provided by Java plugin:
      FAILURE: Build failed with an exception.

      • Where:
        Build file '/home/tomek/temp/reportng/reportng/build.gradle' line: 3
      • What went wrong:
        A problem occurred evaluating root project 'reportng'.
        Cause: Cannot add task ':clean' as a task with that name already exists.

      Possible solutions (ideas from mailing list discussion):
      a) implement an "ovewriteTaskByDefault" feature in Gradle
      b) I think the solution lives on AntBuilder or some other Ant-specific thing. Some options:

      • ant.import() allows you to specify a namespace for the imported tasks, eg prefix each task with 'ant.'
      • ant.import() allows you to specify which tasks to include or exclude when importing.

        Attachments

          Activity

            People

            • Assignee:
              ldaley Luke Daley
              Reporter:
              tomekk Tomek Kaczanowski
            • Votes:
              11 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: