[GRADLE-3258] Gradle doesn't report abbreviated task name as ambiguous when task name has numbers Created: 06/Mar/15  Updated: 16/Jan/17  Resolved: 16/Jan/17

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Sterling Greene Assignee: Unassigned
Resolution: Duplicate Votes: 2


Given this build file:

task unique1()
task uniqueA()

Running with this command-line should produce an ambiguous task selection error between unique1 and uniqueA.

gradle unique

Instead, we select unique1. Tested with 1.0, 2.0, 2.2.1 and master (2.4 nightly).

Comment by Stefan Neuhaus [ 11/Dec/15 ]

It's not an issue with the numbers, but with the casing. Execute the following:

gradle uni

Also with the following build file without any numbers the task unique is unambigously chosen:

task unique()
task uniqueA()

But when instead lowercasing the "A", the ambiguity is properly detected:

task unique1()
task uniquea()

Tested with master (2.11).

Comment by Stefan Neuhaus [ 12/Dec/15 ]

I am not sure what the expected behavior of the task name matching is. The User Guide is not very specific regarding this point (cf. 4.4. Task name abbreviation).

But "NameMatcherTest" defines a couple of valuable test cases of which "prefersFullCamelCaseMatchOverCamelCasePrefix" seems to perfectly reflect this issue:

    public void prefersFullCamelCaseMatchOverCamelCasePrefix() {
        assertMatches("sN", "someName", "someNameWithExtra");
        assertMatches("name", "names", "nameWithExtra");  // reads like "gradlew name" only matches "names" of the tasks ["names", "nameWithExtra"]
        assertMatches("s_n", "some_name", "some_name_with_extra");

Thus to me it looks like the behavior might be somewhat confusing, but at least seems to be in line with the specification.

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:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Martin d'Anjou [ 15/Nov/16 ]

Problem as in description still exists with Gradle 3.2.

Comment by Sterling Greene [ 16/Jan/17 ]

Moved to https://github.com/gradle/gradle/issues/1185

Generated at Wed Jun 30 12:44:08 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.