I am new to gradle and I wan to migrate one existing maven project to gradle.
I have writen the init.gradle file:
allprojects {
repositories {
maven {
url = uri("URL1")
credentials {
username = System.getenv("REPO_USER")
password = System.getenv("REPO_PASS")
}
}
maven {
url = uri("URL2")
credentials {
username = System.getenv("REPO_USER")
password = System.getenv("REPO_PASS")
}
mavenContent {
snapshotsOnly()
}
}
maven {
url =uri("URL3")
credentials {
username = System.getenv("REPO_USER")
password = System.getenv("REPO_PASS")
}
}
}
}
When I issue the ‘gradle init’ command it still tries to download from maven central (which is not accessible), as show the console error:
Execution failed for task ‘:init’ (registered by plugin ‘org.gradle.build-init’).
Could not resolve all files for configuration ‘detachedConfiguration1’.
Could not resolve org.apache.maven:maven-core:3.9.5.
Required by:
detached context for root project ‘horus-common-api’
Could not resolve org.apache.maven:maven-core:3.9.5.
Could not get resource ‘https://repo.maven.apache.org/maven2/org/apache/maven/maven-core/3.9.5/maven-core-3.9.5.pom’.
Could not GET ‘https://repo.maven.apache.org/maven2/org/apache/maven/maven-core/3.9.5/maven-core-3.9.5.pom’.
How can I use gradle init with a private repository ?
I use gradle version 9.6.1.