Gradle task or method to find resolved version of the dynamic dependency

Firstly you can determine this from the command-line by doing something like

./gradlew dependencies --configuration=compile

(Substitute compile with the configuration of your choice).

To determine programmatically what it will be, you are required to resolve the configuration. So a simple way would be to do

project.configurations.getByName('WHATEVER').files.find { it.name.startsWith('commons-lang') }

or you could do

project.configurations.getByName('WHATEVER').resolvedConfiguration.resolvedArtifacts
    .find { name == 'commons-lang }.moduleVersion.id.version