我正在将 jdk 11 迁移到 jdk 17,并将 gradle 版本从 6.6.1 更新到 7.4 更改版本后,我尝试使用 gradle war 命令进行战争,但此时失败了 -
> Task :project:npmInstall FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Some problems were found with the configuration of task ':project:npmInstall' (type 'NpmInstallTask').
- In plugin 'com.moowork.gradle.node.NodePlugin' type 'com.moowork.gradle.node.task.NpmInstallTask' property 'args' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
1. Add an input or output annotation.
2. Mark it as @Internal.
Please refer to https://docs.gradle.org/7.4/userguide/validation_problems.html#missing_annotation for more details about this problem.
- In plugin 'com.moowork.gradle.node.NodePlugin' type 'com.moowork.gradle.node.task.NpmInstallTask' property 'result' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
1. Add an input or output annotation.
2. Mark it as @Internal.
我是新开发人员,请帮助我需要进行哪些更改。 下面是我的 build.gradle 文件 -
buildscript {
repositories {........}
dependencies {
classpath 'com.moowork.gradle:gradle-grunt-plugin:0.13'
classpath 'com.moowork.gradle:gradle-node-plugin:0.12'
}
}
apply plugin: 'com.moowork.grunt'
apply plugin: 'java'
apply plugin: 'war'
node {
version = '16.19.1'
distBaseUrl = 'https://somelink'
download = true
workDir = file("${project.projectDir}")
}
grunt {
workDir = file("${project.projectDir}")
colors = true
bufferOutput = false
}
grunt_bowercopy.dependsOn 'npmInstall'
grunt_copy.dependsOn 'npmInstall'
war.dependsOn ':project-ui:buildAngularApp'
war.dependsOn grunt_bowercopy
war.dependsOn grunt_copy
war.dependsOn grunt_less
war.dependsOn grunt_stylus
有一个project-ui的build.gradle文件-
buildscript {
repositories {....}
dependencies {
classpath "com.github.node-gradle:gradle-node-plugin:3.4.0"
}
}
apply plugin: 'com.github.node-gradle.node'
node {
distBaseUrl = 'https://somelink'
version = '16.19.1'
download = true
}
task buildAngularApp {}
buildAngularApp.dependsOn npmInstall
buildAngularApp.dependsOn npm_run_build
test.dependsOn 'npm_run_test-no-watch'
插件 com.moowork.grunt 上次发布于 2019 年。它很可能不支持当前版本的 Gradle 甚至 Java 17。您应该尝试找到最近发布的类似插件,并将您的项目迁移到它。