jagadeesh-Gs-MacBook:Contact jagadeeshgundlapalle$ gradle
:help
Welcome to Gradle 2.2.1.
To run a build, run gradle <task> ...
To see a list of available tasks, run gradle tasks
To see a list of command-line options, run gradle --help
BUILD SUCCESSFUL
Total time: 16.4 secs
jagadeesh-Gs-MacBook:Contact jagadeeshgundlapalle$ gradle jar
:compileJava
/Users/jagadeeshgundlapalle/Documents/workspace3/Contact/src/main/java/gurukul/ContactListController.java:4: package org.springframework.web.bind.annotation does not exist
import org.springframework.web.bind.annotation.RequestMapping;
^
/Users/jagadeeshgundlapalle/Documents/workspace3/Contact/src/main/java/gurukul/ContactListController.java:5: package org.springframework.web.bind.annotation does not exist
import org.springframework.web.bind.annotation.RequestParam;
^
/Users/jagadeeshgundlapalle/Documents/workspace3/Contact/src/main/java/gurukul/ContactListController.java:6: package org.springframework.web.bind.annotation does not exist
import org.springframework.web.bind.annotation.RestController;
^
/Users/jagadeeshgundlapalle/Documents/workspace3/Contact/src/main/java/gurukul/ContactListController.java:9: cannot find symbol
symbol: class RestController
@RestController
^
/Users/jagadeeshgundlapalle/Documents/workspace3/Contact/src/main/java/gurukul/ContactListController.java:14: cannot find symbol
symbol : class RequestMapping
location: class gurukul.ContactListController
@RequestMapping("/getList")
^
5 errors
:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* 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.53 secs
3条答案
按热度按时间mv1qrgav1#
将spring-web.jar添加到您的依赖项:
8wtpewkr2#
当我尝试使用gradle构建带有spring Boot 的项目时,我遇到了类似的问题。默认情况下,springboot项目是使用build.gradle文件中的此引用创建的:
更改此参考:
为此:
对我很有效。
bf1o4zei3#
更改此参考:
实现'org.springframework.boot:Spring引导启动程序'
为此:
实现'org. springframework. boot:spring-boot-starter-web'它对我很有效。