Issue title: Something is broken with abbreviated task names
 Issue body: I'm in the process of upgrading our build from 1.12 to 3.4.1.
Somewhere in between it seems the ability to interpret abbreiviated task names got only half working suddenly.

Here some examples:

This seems to decide to run the task `integTest` while `iT` should be ambiguous between `integTest`, `integTestClasses`, `integTestGenClasses` and `integTestJar`, shouldn't it?

    $ gradlew iT -m | grep -F central-suite:integTest
    :central-suite:integTestClasses SKIPPED
    :central-suite:integTestJar SKIPPED
    :central-suite:integTestEar SKIPPED
    :central-suite:integTest SKIPPED

Only difference here is that the subproject is added. Now `integTest` is not seen at all anymore, not even in the list of ambiguous tasks, but it should, shouldn't it?
    
    $ gradlew c-s:iT -m | grep -F central-suite:integTest
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Task 'iT' is ambiguous in project ':central-suite'. Candidates are: 'integTestClasses', 'integTestGenClasses', 'integTestJar'.

This is just to show that the task exists:
    
    $ gradlew :empic-suite:createOrRecreateUserAndTablespace -m | grep -F :empic-suite:createOrRecreateUserAndTablespace
    :empic-suite:createOrRecreateUserAndTablespace SKIPPED

Only the last character omitted and now the task is not found at all anymore? o_O
    
    $ gradlew :empic-suite:createOrRecreateUserAndTablespac -m | grep -F :empic-suite:createOrRecreateUserAndTablespace
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Task 'createOrRecreateUserAndTablespac' not found in project ':empic-suite'.

 Comments: 
 Comment 0: Thanks for reporting. Are you interested in providing a pull request?
 Comment 1: I'm not one who you need to trigger to create pull requests, I often did already. ;-)
Actually still one of mine is waiting for feedback or integration.
Maybe I'll do if I find time to investigate, but I didn't have time right now but wanted to at least report it. :-)
 Comment 2: > I'm not one who you need to trigger to create pull requests, I often did already. ;-)

You never know. You might have gotten sick of it. ;-)

> Actually still one of mine is waiting for feedback or integration.

Currently working my way through the backlog.
 Comment 3: > You never know. You might have gotten sick of it. ;-)

As my last one is just from one week ago, probably not. And **if** this would be the case, then the question would probably also not change this. :-D
 Comment 4: Maybe relevant information, the task `integTest` is added in an `afterEvaluate` closure.
 Comment 5: This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you're interested in how we try to keep the backlog in a healthy state, please read our [blog post on how we refine our backlog](https://blog.gradle.org/stale-issue-backlog). If you feel this is something you could contribute, please have a look at our [Contributor Guide](https://github.com/gradle/gradle/blob/master/CONTRIBUTING.md). Thank you for your contribution.

 Comment 6: This seems to work better now.
Our project is still on 4.10.3, but at least the latter case works properly now and the first two examples at least behave consistent in both running the `integTest` task.

But I'm still under the impression that `iT` should be ambiguous instead of running `integTest`, shouldn't it?
Actually it might be handy to not be though and it might be inteded.
So as the other problems seem to be better now, I close this.
{'source': 'GithubIssues', 'repo_name_with_owner': 'gradle/gradle', 'issue_id': 214400001, 'repo_stars': 14999.0}