In case we pass environment variable for values of a gradle’s project property
say in build.gradle say, we use:
url "https://${nexusDomain}/repository/gvhvid-maven-public"
then running snyk test
for a gradle project fails with following error:
ERROR: Gradle Error (short):
> Could not get unknown property 'nexusDomain' for root project 'gvhvid-service' of type org.gradle.api.Project.
because snyk test
implicitly runs following command:
/builds/gvhvid/gradlew' snykResolvedDepsJson -q --build-file /builds/gvhvid/build.gradle
-Dorg.gradle.parallel= -Dorg.gradle.console=plain -I /tmp/tmp-580-SoPWUNy9S4bm--init.gradle
--no-configuration-cache
Possible solution is to pass the value for project property: nexusDomain
via snyk CLI
So, the fix I tried using the SNYK CLI option: --configuration-attributes
but that does not seems to be working!
Fix that I found is to pass the value for gradle project property as an environment variables are visible to gradle using special prefix ORG_GRADLE_PROJECT_
to the build
say:
ORG_GRADLE_PROJECT_nexusDomain="gvh.vid.com"
and then run snyk test
worked! ☺️