想到分享以下信息,因为我花了几个小时才发现这个:
Spring boot 1.3.3项目没有使用gradle 3构建,因为spring gradle插件是为gradle 2构建的。因此,只使用gradle 2而不是gradle 3构建此项目。
$ gradle build
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_2yz3q0eod1vuhee49o6tow8db.run(C:\Users\nm_su\Projects\provisioning\mobipm\build.gradle:23)
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\nm_su\Projects\provisioning\mobipm\build.gradle' line: 26
* What went wrong:
A problem occurred evaluating root project 'mobipm'.
> Failed to apply plugin [class 'io.spring.gradle.dependencymanagement.DependencyManagementPlugin']
> Could not create task of type 'DependencyManagementReportTask'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 11.67 secs
$ gradle --version
------------------------------------------------------------
Gradle 3.2.1
------------------------------------------------------------
Build time: 2016-11-22 15:19:54 UTC
Revision: 83b485b914fd4f335ad0e66af9d14aad458d2cc5
Groovy: 2.4.7
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_111 (Oracle Corporation 25.111-b14)
OS: Windows 10 10.0 amd64
现在让我们尝试用gradle 2.14.1构建,
$ gradle build
:framework:compileJava
:framework:processResources UP-TO-DATE
:framework:classes
:framework:jar
:compileJava
:processResources UP-TO-DATE
:classes
:findMainClass
:jar
:bootRepackage
:assemble
:compileTestJava
:processTestResources UP-TO-DATE
:testClasses
:test
:check
:build
:framework:findMainClass
:framework:bootRepackage
:framework:assemble
:framework:compileTestJava
:framework:processTestResources UP-TO-DATE
:framework:testClasses
:framework:test
:framework:check
:framework:build
BUILD SUCCESSFUL
Total time: 31.104 secs
$ gradle --version
------------------------------------------------------------
Gradle 2.14.1
------------------------------------------------------------
Build time: 2016-07-18 06:38:37 UTC
Revision: d9e2113d9fb05a5caabba61798bdb8dfdca83719
Groovy: 2.4.4
Ant: Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_111 (Oracle Corporation 25.111-b14)
OS: Windows 10 10.0 amd64
如果您正在使用eclipse插件" Buildship Gradle Integration 2.0",那么在导入Spring boot 1.3.3项目时,明确选择gradle的oldversion如下所示
答案 0 :(得分:0)
确保build.gradle具有"包装器"任务如下:
Ref::map
运行" gradle wrapper"从命令行,它将为unix和windows创建gradle包装器。将它们推送到源控制器,这样就没有手动步骤。
Ref
因此所有未来版本都可以使用gradlew
task wrapper(type: Wrapper) {
gradleVersion = '2.9'
}
感谢吸血鬼的回答......