When building our Cordova Android application, the build fails because of failing connections to https://repo.maven.apache.org/maven2
e.g.
Could not get resource 'https://repo.maven.apache.org/maven2/io/github/g00fy2/versioncompare/1.4.1/versioncompare-1.4.1.pom'.
We sit behind a company network and all the dependencies are available via https://mycompany.com
We struggle to set the gradle repositories globally to https://mycompany.com
the init.gradle seems to not affect the gradle repos in de Cordova project.
init.gradle content
allprojects {
buildscript {
repositories {
maven {
url "https://mycompany.com"
allowInsecureProtocol = false
}
google()
}
}
repositories {
maven {
url "https://mycompany.com"
allowInsecureProtocol = false
}
google()
}
}
I managed to build successfully by hardcoding the repos in this files
- platforms/android/repositories.gradle
- platforms/android/app/repositories.gradle
- platforms/android/CordovaLib/repositories.gradle
with this content
ext.repos = {
maven {
url "https://mycompany.com"
allowInsecureProtocol = false
}
google()
}
Of course, this is not a great solution.
Is there a way to enforce the gradle repos in a Cordova project?
I tried the build-extras.gradle approach as described here, but the build still tries to connect to https://repo.maven.apache.org/maven2
System info:
win 11
cordova android version: 15.0.0-nightly.20251110002700134.sha.655aa0a5, but similar issue with 14.0.1
gradle version 9.2.0