我已经在macOS Ventura 13.2.1上使用openjdk版本“19.0.2”2023-01-17使用(Home)brew从Gradle 7.6升级到8.0。
gradle build clean
FAILURE: Build failed with an exception.
* What went wrong:
'java.io.File org.gradle.api.reporting.ConfigurableReport.getDestination()'
* 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.
gradle build clean --scan:
Started today at 08:04:46 GMT, finished today at 08:04:51 GMT
Gradle 8.0,Gradle Enterprise plugin 3.12.3
Explore console log
1 failure
'java.io.File org.gradle.api.reporting.ConfigurableReport.getDestination()'
'java.io.File org.gradle.api.reporting.ConfigurableReport.getDestination()'
探索失败:
Failure 1 of 1'java.io.File org.gradle.api.reporting.ConfigurableReport.getDestination()'
'java.io.File org.gradle.api.reporting.ConfigurableReport.getDestination()'
Exception
java.lang.NoSuchMethodError: 'java.io.File org.gradle.api.reporting.ConfigurableReport.getDestination()'
at name.remal.gradle_plugins.dsl.extensions.Org_gradle_api_reporting_ConfigurableReportKt.setDefaultDestinationForTask(org.gradle.api.reporting.ConfigurableReport.kt:63)
at name.remal.gradle_plugins.plugins.common.ReportsSettingsPlugin$Setup all tasks with reports$1$1.execute(ReportsSettingsPlugin.kt:24)
at name.remal.gradle_plugins.plugins.common.ReportsSettingsPlugin$Setup all tasks with reports$1$1.execute(ReportsSettingsPlugin.kt:16)
•••
at name.remal.gradle_plugins.plugins.common.ReportsSettingsPlugin$Setup all tasks with reports$1.execute(ReportsSettingsPlugin.kt:22)
at name.remal.gradle_plugins.plugins.common.ReportsSettingsPlugin$Setup all tasks with reports$1.execute(ReportsSettingsPlugin.kt:16)
•••
at name.remal.gradle_plugins.plugins.common.ReportsSettingsPlugin.Setup all tasks with reports(ReportsSettingsPlugin.kt:20)
•••
at name.remal.gradle_plugins.dsl.extensions.Java_lang_reflect_MethodKt.invokeForInstance(java.lang.reflect.Method.kt:21)
at name.remal.gradle_plugins.dsl.reflective_project_plugin.action_param_injector.ExtensionsKt.invokeForProject(extensions.kt:15)
at name.remal.gradle_plugins.dsl.reflective_project_plugin.action_param_injector.ExtensionsKt.invoke(extensions.kt:23)
at name.remal.gradle_plugins.dsl.BaseReflectiveProjectPlugin$doActions$1$7.invoke(BaseReflectiveProjectPlugin.kt:103)
at name.remal.gradle_plugins.dsl.BaseReflectiveProjectPlugin$doActions$1$7.invoke(BaseReflectiveProjectPlugin.kt:19)
at name.remal.gradle_plugins.dsl.extensions.Org_gradle_api_plugins_PluginManagerKt.withPluginIds(org.gradle.api.plugins.PluginManager.kt:67)
at name.remal.gradle_plugins.dsl.extensions.Org_gradle_api_ProjectKt.withPluginIds(org.gradle.api.Project.kt:193)
at name.remal.gradle_plugins.dsl.BaseReflectiveProjectPlugin$doActions$1.invoke(BaseReflectiveProjectPlugin.kt:88)
at name.remal.gradle_plugins.dsl.BaseReflectiveProjectPlugin$doActions$1.invoke(BaseReflectiveProjectPlugin.kt:19)
at name.remal.gradle_plugins.dsl.extensions.Org_gradle_api_plugins_PluginManagerKt.withPluginIds(org.gradle.api.plugins.PluginManager.kt:67)
at name.remal.gradle_plugins.dsl.extensions.Org_gradle_api_ProjectKt.withPluginIds(org.gradle.api.Project.kt:193)
at name.remal.gradle_plugins.dsl.BaseReflectiveProjectPlugin.doActions(BaseReflectiveProjectPlugin.kt:67)
at name.remal.gradle_plugins.dsl.BaseReflectiveProjectPlugin.applyImpl(BaseReflectiveProjectPlugin.kt:43)
at name.remal.gradle_plugins.dsl.BaseProjectPlugin.apply(BaseProjectPlugin.kt:57)
at name.remal.gradle_plugins.dsl.BaseProjectPlugin.apply(BaseProjectPlugin.kt:23)
•••
at name.remal.gradle_plugins.dsl.extensions.Org_gradle_api_ProjectKt.applyPlugin(org.gradle.api.Project.kt:195)
at name.remal.gradle_plugins.dsl.BaseReflectiveProjectPlugin$doActions$1.invoke(BaseReflectiveProjectPlugin.kt:69)
at name.remal.gradle_plugins.dsl.BaseReflectiveProjectPlugin$doActions$1.invoke(BaseReflectiveProjectPlugin.kt:19)
at name.remal.gradle_plugins.dsl.extensions.Org_gradle_api_plugins_PluginManagerKt.withPluginIds(org.gradle.api.plugins.PluginManager.kt:67)
at name.remal.gradle_plugins.dsl.extensions.Org_gradle_api_ProjectKt.withPluginIds(org.gradle.api.Project.kt:193)
at name.remal.gradle_plugins.dsl.BaseReflectiveProjectPlugin.doActions(BaseReflectiveProjectPlugin.kt:67)
at name.remal.gradle_plugins.dsl.BaseReflectiveProjectPlugin.applyImpl(BaseReflectiveProjectPlugin.kt:43)
at name.remal.gradle_plugins.dsl.BaseProjectPlugin.apply(BaseProjectPlugin.kt:57)
at name.remal.gradle_plugins.dsl.BaseProjectPlugin.apply(BaseProjectPlugin.kt:23)
•••
返回Gradle 7.6:
/gradlew build clean --warning-mode=all
> Configure project :
The Report.destination property has been deprecated. This is scheduled to be removed in Gradle 8.0. Please use the outputLocation property instead. See https://docs.gradle.org/7.6/dsl/org.gradle.api.reporting.Report.html#org.gradle.api.reporting.Report:destination for more details.
The Report.enabled property has been deprecated. This is scheduled to be removed in Gradle 8.0. Please use the required property instead. See https://docs.gradle.org/7.6/dsl/org.gradle.api.reporting.Report.html#org.gradle.api.reporting.Report:enabled for more details.
>>>>> 1 deleteFiles
>>>>> 2 NOTiFYmotoWAR
The AbstractArchiveTask.archiveName property has been deprecated. This is scheduled to be removed in Gradle 8.0. Please use the archiveFileName property instead. See https://docs.gradle.org/7.6/dsl/org.gradle.api.tasks.bundling.AbstractArchiveTask.html#org.gradle.api.tasks.bundling.AbstractArchiveTask:archiveName for more details.
at build_6fdw9omce69ijjc1fgog2e4q0$_run_closure13.doCall(/Users/NOTiFY/IdeaProjects/NOTiFYmoto/build.gradle:265)
(Run with --stacktrace to get the full stack trace of this deprecation warning.)
>>>>> 3 NOTiFYmotoJAR
>>>>> 4 copyNOTiFYmotoWAR
>>>>> 5 copyNOTiFYmotoJAR
>>>>> 6 NOTiFYmotoEAR
我的Gradle:
plugins {
id("war")
id("ear")
id("idea")
id("java-library")
id("org.jetbrains.kotlin.jvm") version "1.8.10"
id("checkstyle")
id("pmd")
id("com.github.spotbugs") version "5.0.13"
id("org.sonarqube") version "3.5.0.2730"
id("name.remal.sonarlint") version "1.5.0"
id("org.wildfly.build.provision") version "0.0.11"
}
configurations.all {
resolutionStrategy {
//force 'xml-apis:xml-apis:1.0.b2'
force 'xml-apis:xml-apis:2.0.2'
}
}
compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
repositories {
mavenLocal()
mavenCentral()
google()
maven {
name "jboss-nexus"
url "http://repository.jboss.org/nexus/content/groups/public/"
url "https://repository.jboss.org/nexus/content/groups/public-jboss"
url "https://repository.jboss.org/nexus/content/repositories"
url "https://repository.jboss.org/nexus/content/repositories/thirdparty-releases"
url "https://repository.primefaces.org"
}
//jcenter()
gradlePluginPortal()
mavenCentral()
flatDir {
dirs "lib"
}
}
dependencies {
compileOnly("jakarta.platform:jakarta.jakartaee-api:10.0.0")
implementation("jakarta.platform:jakarta.jakartaee-web-api:10.0.0")
// JUnit (Jupiter) 5.9.0)
testImplementation('org.junit.jupiter:junit-jupiter-api:5.9.2')
testImplementation('org.junit.jupiter:junit-jupiter-engine:5.9.2')
testImplementation('org.junit.vintage:junit-vintage-engine:5.9.2')
testImplementation("org.testng:testng:7.7.0")
implementation("org.apache.maven.surefire:surefire-testng:2.22.2")
implementation("org.slf4j:slf4j-api:2.0.5")
implementation("org.slf4j:slf4j-simple:2.0.5")
implementation('com.puppycrawl.tools:checkstyle:10.7.0')
implementation("dev.morphia.morphia:morphia-core:2.3.0")
// Omnifaces 4.0.1 - November 2022
implementation("org.omnifaces:omnifaces:4.0.1")
implementation("org.primefaces:primefaces-12.0.3-jakarta")
implementation("org.primefaces.themes:bootstrap:1.0.10")
// BootsFaces
implementation("net.bootsfaces:bootsfaces:1.5.0")
implementation("org.mongodb:mongodb-driver-core:4.8.2")
implementation("org.mongodb:mongodb-driver-sync:4.8.2")
implementation("org.mongodb:bson:4.8.2")
implementation('io.github.classgraph:classgraph:4.8.154')
implementation('net.bytebuddy:byte-buddy:1.12.21')
implementation('com.google.code.gson:gson:2.10.1')
// Kotlin - 2022-12-28
implementation('org.jetbrains.kotlin:kotlin-stdlib:1.8.10')
implementation("org.jsoup:jsoup:1.15.3")
providedCompile("org.eclipse.persistence:javax.persistence:2.2.1")
providedCompile("javax.inject:javax.inject:1")
providedCompile("javax.faces:javax.faces-api:2.3")
providedCompile("jakarta.enterprise:jakarta.enterprise.cdi-api:4.0.1")
providedCompile("org.jboss.resteasy:resteasy-jaxrs:3.15.3.Final")
providedCompile('com.google.code.gson:gson:2.10.1')
providedCompile("javax.ws.rs:javax.ws.rs-api:2.1.1")
providedCompile("org.slf4j:slf4j-api:2.0.5")
providedCompile("org.slf4j:slf4j-simple:2.0.5")
spotbugsPlugins("com.h3xstream.findsecbugs:findsecbugs-plugin:1.12.0")
}
checkstyleMain {
source = ["src/main/java"]
}
checkstyle {
toolVersion "10.7.0"
configFile = file("config/checkstyle/checkstyle.xml")
}
spotbugs {
ignoreFailures = true
toolVersion = '4.7.3'
reportsDir = file("reports/spotbugs")
effort = "max"
reportLevel = "high"
// ignoreFailures = false
showProgress = true
// showStackTraces = false
// effort = "default"
// reportLevel = "default"
// visitors = [ "FindSqlInjection", "SwitchFallthrough" tVisitors = [ "FindNonShortCircuit" ]
// reportsDir = filef("$buildDir/ƒprime")
// includeFilter = file("include.xml")
// excludeFilter = file("exclude.xml")
// onlyAnalyze = [ "com.foobar.MyClass", "com.foobar.mypkg.*" ]
// maxHeapSize = "1g"
// extraArgs = [ "-nested:false" ]
// jvmArgs = [ "-Duser.language=ja" ]
}
pmd {
ignoreFailures = true
reportsDir = file("reports/pmd")
ruleSets = [
"java-basic",
"java-braces",
"java-clone",
"java-codesize",
"java-comments",
"java-controversial",
"java-coupling",
"java-design",
"java-empty",
"java-finalizers",
"java-imports",
"java-optimizations",
"java-strictexception",
"java-strings",
"java-typeresolution",
"java-unnecessary",
"java-unusedcode"
]
}
// SonarLint & SonarQube
sonarlint {
ignoreFailures = true
// excludes {
// message 'java:S1214'
// message 'kotlin:S100'
// message 'xml:S125'
// }
// includes {
// message 'java:S4266' // Enable java:S4266 which is disabled by default
// }
// ruleParameter('java:S119', 'format', '^[A-Z][a-zA-Z0-9]*$') // Allow upper camel-case for type parameter names
}
tasks.withType(Pmd) {
reports {
xml.enabled = true
html.enabled = true
}
}
tasks.withType(Checkstyle) {
reports {
html.destination rootProject.file("reports/checkstyle/checkstyle.html")
}
}
task deleteFiles(type: Delete) {
project.logger.lifecycle(">>>>> 1 deleteFiles")
delete fileTree("./build/libs") {
include "**/NOTiFYmoto*.?ar"
}
delete fileTree("./src/main/application") {
include "**/NOTiFYmoto*.war"
include "**/NOTiFYmoto*.jar"
include "**/NOTiFYmoto*.ear"
}
}
task NOTiFYmotoWAR(type: War) {
project.logger.lifecycle(">>>>> 2 NOTiFYmotoWAR")
dependsOn deleteFiles
archiveName "NOTiFYmotoWAR.war"
//archiveFileName "NOTiFYmotoWAR.war"
//webInf {
// from "WEB-INF"
//}
rootSpec.exclude("**/dto/*")
rootSpec.exclude("**/ean/*")
rootSpec.exclude("**/ejb/*")
rootSpec.exclude("**/entity/*")
rootSpec.exclude("**/filter/*")
rootSpec.exclude("**/gson/*")
rootSpec.exclude("**/morphia-*.jar")
rootSpec.exclude("**/mongo*.jar")
rootSpec.exclude("**/bson*.jar")
rootSpec.exclude("**/surefire*.jar")
rootSpec.exclude("**/controller*/*")
// Exclude push PushEvent.class
rootSpec.exclude("**/push/PushEvent.class")
//rootSpec.exclude("**/layout/img/OmniFaces-icon-*")
rootSpec.exclude("**/webservices/*")
rootSpec.exclude("**/checkstyle*.jar")
rootSpec.exclude("**/classgraph*.jar")
rootSpec.exclude("**/kotlin*.jar")
rootSpec.exclude("**/NOTiFYmoto*.jar")
rootSpec.exclude("**/NOTiFYmoto*.war")
}
task NOTiFYmotoJAR(type: Jar) {
project.logger.lifecycle(">>>>> 3 NOTiFYmotoJAR")
dependsOn NOTiFYmotoWAR
archiveName "NOTiFYmotoJAR.jar"
// archiveFileName "NOTiFYmotoJAR.jar"
from("./src/main/java") {
include "META-INF/**"
}
// Exclude
rootSpec.exclude("**/jsf/SliderViewBean.class")
rootSpec.exclude("**/push/PushBean.class")
from("./build/classes/java/main") {
include "*/**"
}
// Kotlin
from("./build/classes/kotlin/main") {
include "*/**"
}
}
task copyNOTiFYmotoWAR(type: Copy) {
project.logger.lifecycle(">>>>> 4 copyNOTiFYmotoWAR")
dependsOn NOTiFYmotoJAR
from file("./build/libs/NOTiFYmotoWAR.war")
into file("./src/main/application")
}
task copyNOTiFYmotoJAR(type: Copy) {
project.logger.lifecycle(">>>>> 5 copyNOTiFYmotoJAR")
dependsOn copyNOTiFYmotoWAR
from file("./build/libs/NOTiFYmotoJAR.jar")
into file("./src/main/application")
}
task NOTiFYmotoEAR(type: Ear) {
project.logger.lifecycle(">>>>> 6 NOTiFYmotoEAR")
apply plugin: "ear"
//compileOnly("org.omnifaces:omnifaces:4.0.1")
dependsOn copyNOTiFYmotoJAR
archiveName "NOTiFYmoto.ear"
// archiveFileName "NOTiFYmoto.ear"
manifest {
from("./src/main/resources/META-INF/MANIFEST.MF")
}
exclude "**/*.class"
exclude "**/asm-Java.jar"
exclude "**/jboss-deployment-structure.xml"
// exclude("**/beans.xml")
dependencies {
earlib group: "com.google.code.gson", name: "gson", version: "2.10", ext: "jar"
earlib group: "org.apache.httpcomponents", name: "httpclient", version: "4.5.13", ext: "jar"
earlib group: "org.apache.httpcomponents", name: "httpcore", version: "4.4.14", ext: "jar"
earlib group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: "1.8.10", ext: "jar"
earlib group: "dev.morphia.morphia", name: "morphia-core", version: "2.3.0", ext: "jar"
earlib group: "org.mongodb", name: "mongodb-driver-core", version: "4.8.2", ext: "jar"
earlib group: "org.mongodb", name: "mongodb-driver-sync", version: "4.8.2", ext: "jar"
earlib group: "org.mongodb", name: "bson", version: "4.8.2", ext: "jar"
earlib group: "net.bytebuddy", name: "byte-buddy", version: "1.12.17", ext: "jar"
earlib group: "io.github.classgraph", name: "classgraph", version: "4.8.153"
spotbugsPlugins("com.h3xstream.findsecbugs:findsecbugs-plugin:1.12.0")
}
}
有什么建议吗?短暂性脑缺血发作
3条答案
按热度按时间cigdeys31#
以下是将build.gradle文件中不推荐使用的报表属性从Gradle 7.x.x.迁移到8.0.0的示例:
Gradle 7.x.x
Gradle 8.0.0
因此,对于问题中的build.gradle,它将从以下位置迁移:
当前
新增
hmae6n7t2#
对于那些谁来这里与类似的问题在sonarqube任务期间收到:
在我的例子中,根本原因是版本不兼容(gradle和sonarqube之间)。
我将gradle版本升级到8.0.2,错误已经被抛出。在阅读文档后,我发现gradle 8.0.x版本有一个新的兼容sonarqube版本。将sonarqube版本升级到
4.0.0.2929
后,它又开始正常工作了。您可以在这里找到更多信息:
piah890a3#
升级到Gradle 8.1:
删除:
还能得到:
./gradlew build clean --scan:
./gradlew build clean --debug
为什么这样:
将Kotlin显示为1.8.10
当它是所有1.8.20: