Skip to content

Instantly share code, notes, and snippets.

@jbaranski
Created August 1, 2020 14:49
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbaranski/65f35e78aa65418bf28f3d5b3368ee4b to your computer and use it in GitHub Desktop.
Save jbaranski/65f35e78aa65418bf28f3d5b3368ee4b to your computer and use it in GitHub Desktop.
Alias a task name in Gradle

The following snippet is how to alias a task name in Gradle:

build.gradle

    // You can now run "gradle alias" and it would be equivalent to running "gradle taskToAlias"
    task alias {
        dependsOn allprojects.collect { proj ->
            proj.tasks.matching {
                it.name == 'taskToAlias'
            }
        }
    }
@markhu
Copy link

markhu commented Aug 26, 2022

Seems simpler to just dependsOn 'taskToAlias' --works in Gradle 7.4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment