parent.gradle.kts:
import java.util.*
apply(from = resources.text.fromInsecureUri("http://repo.bt/repository/common-upload/upload_https.gradle"))
group = "com.ab.project"
repositories {
maven {
url=uri("http://repo.bt/repository/maven-public/")
isAllowInsecureProtocol = true
metadataSources {
mavenPom()
ignoreGradleMetadataRedirection()
}
}
}
val remotes: MutableMap<String, MutableMap<String, Any>> = mutableMapOf()
remotes["develop"] = passwordRemote("10.18.20.80", 22, "root", "123456")
fun passwordRemote(host: String, port: Int, user: String, password: String): MutableMap<String, Any>{
return mutableMapOf("host" to host, "port" to port, "user" to user, "password" to password)
}
extra["remotes"] = remotes
gradle version: 8.2.1
java open sdk: 17.0.8
the gradle project A applys the file (parent.gradle.kts) from two different way:
- project A’s build.gradle.kts:
apply(from = resources.text.fromInsecureUri("http://repo.bt/repository/common-upload/parent.gradle.kts"))
exception:
Build file 'C:\ProjectFamily\pjfamily-config\build.gradle.kts' line: 12
Could not open cp_dsl generic class cache for script 'C:\Users\...\.gradle\.tmp\resource\wrappedInternalText17470423575089172138.txt' (C:\Users\...\.gradle\caches\8.2.1\scripts\46vzq4wslg6f3pgsptuope9an).
> Could not compile script 'C:\Users\...\.gradle\.tmp\resource\wrappedInternalText17470423575089172138.txt'.
> startup failed:
script 'C:\Users\...\.gradle\.tmp\resource\wrappedInternalText17470423575089172138.txt': 22: Unexpected input: 'passwordRemote(host: String, port: Int, user: String, password: String):' @ line 22, column 76.
ser: String, password: String): MutableM
seem it doesn’t support Kotlin?
because I use var variable:String?=XXX
show the same error with ?
.
- project A’s build.gradle.kts:
apply(from = "../parent.gradle.kts") // download the file and use it locally, it works.