apply from: "$scriptPath/FrameworkConfig.gradle" def frameworkJar = getFrameworkJarPath(gradle.gradleUserHomeDir, sdkInt) gradle.projectsEvaluated { tasks.withType(JavaCompile).configureEach { String taskName = it.name if (taskName.contains("UnitTest") || taskName.contains("AndroidTest")) { return } //println("${getProject()} -> ${it.name}") //println("${getProject()} add framework jar -> $frameworkJar") // 对于当前环境(JDK17、Gradle8.2、Android Gradle Plugin 8.1.3)是这句起作用 classpath = files(frameworkJar, classpath) options.bootstrapClasspath = files(frameworkJar, options.bootstrapClasspath) } } dependencies { compileOnly files(frameworkJar) }