Avoid directories in Groovy detection

Directories such as:

grapes/org.codehaus.groovy

caused a failure in the Groovy detect logic, so filter out
directories.

Add a test to verify the correct behaviour.

[#53781773]
Merge 53781773-groovy-detection-fix to master

[Completes #53781773]