Description
Having an android gradle application, where the application is using gradlew (gradle wrapper) for the
build.
When trying to translate and scan remotely by push as -bt "gradle", it fails because the scancentral client tries to download gradle v8.0 for a public URL.
scancentral -url ${SC_CONTROLLER_URL} start -bt "gradle" -upload -application App1 -version v01 -uptoken $SSC_UPLOAD_TOKEN -block -f scan.fpr
ScanCentral 23.2.1 Log:
Gathering project information...
No build file specified. Run auto build file detection.
Run packaging with GRADLE integration and /runner/build.gradle build file.
Downloading https://services.gradle.org/distributions/gradle-8.0-bin.zip
Exception in thread "main" java.net.UnknownHostException: services.gradle.org
An error occurred building the project. Scan results may be incorrect. Please make sure the project is compilable. See log for details.
Shutting down with errors. Please see log for details.
Error generating scan specification
Gradle build failed.
Error: Process completed with exit code 1.
Resolution
For Gradle projects, typically on the directory \gradle\wrapper\ there is a file called gradle-wrapper.properties.
The content typically is (in my example):
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
You might play with that distribution URL on your projects if you're not allowed to pick it up from the Internet and have the Gradle binaries available locally.
Alternatively, if the right gradle version used by the project is already on the system, the ScanCentral will not need to query the distributionUrl as you're seeing, so those would be the prerequisites:
- Have Gradle version for the project preinstalled(Gradle Wrapper Reference)
- If the Gradle distribution is unavailable on the machine, the Wrapper will download it and store it in the local file system. Any subsequent build invocation will reuse the existing local distribution as long as the distribution URL in the Gradle properties doesn’t change.
- Set a distributionUrl that is accessible by the machine running ScanCentral (it can be an URL or it can be a "file URL")
Also consider that Gradle will possibly need access to the repositories used in the project to download its dependencies from the machine running ScanCentral.