FAILURE: Build failed with an exception.
Could not find tools.jar. Please check that /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home contains a valid JDK installation.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 781ms
1 actionable task: 1 executed
innocentyang@192 Learn % java -version
java version "1.8.0_261"
Java™ SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot™ 64-Bit Server VM (build 25.261-b12, mixed mode)
innocentyang@192 Learn %
发布失败的提示信息是说找不到tool.jar?看不懂是哪里出了问题。
maven-publish.gradle完全是照着视频抄的,应该也没抄错:
apply plugin: "maven" // 使用maven插件中的发布功能
// 公共参数
Properties gradleProperties = new Properties()
gradleProperties.load(project.rootProject.file("gradle.properties").newDataInputStream())
def VERSION_NAME = gradleProperties.getProperty("VERSION_NAME")
def POM_URL = gradleProperties.getProperty("POM_URL")
def GROUP_ID = gradleProperties.getProperty("GROUP_ID")
// 子工程
Properties projectGradleProperties = new Properties()
projectGradleProperties.load(project.file("gradle.properties").newDataInputStream())
def POM_ARTIFACT_ID = projectGradleProperties.getProperty("POM_ARTIFACT_ID")
println("maven-publish VERSION_NAME = " + VERSION_NAME)
println("maven-publish POM_URL = " + POM_URL)
println("maven-publish GROUP_ID = " + GROUP_ID)
println("maven-publish POM_ARTIFACT_ID = " + POM_ARTIFACT_ID)
uploadArchives {
repositories {
mavenDeployer {
// 填入发布信息
repository(url: uri(POM_URL)) {
pom.groupId = GROUP_ID
pom.version = VERSION_NAME
pom.artifactId = POM_ARTIFACT_ID
}
pom.whenConfigured { pom ->
pom.dependencies.forEach { dep ->
if (dep.getVersion() == "unspecified") {
dep.setGroupId(GROUP_ID)
dep.setVersion(VERSION_NAME)
}
}
}
}
}
}
请老师帮忙看看是哪里写错了?