我有gradle的spring boot项目。我想使用json-smart库来处理存储在MySQL String记录中的小型json数据。
这是我对build.gradle的依赖:
dependencies {
compile("org.springframework.data:spring-data-commons:1.10.2.RELEASE")
compile("org.springframework.boot:spring-boot-starter-jdbc")
compile("net.minidev:json-smart:2.2")
runtime("mysql:mysql-connector-java")
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("junit:junit")
}
我可以成功运行命令:
gradlew clean build
但是我不能导入JSONValue对象。似乎gradle并没有下载所有依赖项。这是我的依赖项:dependencies screenshot
这是output from gradlew clean build command
如何管理导入和使用json-smart JSONValue对象?
最佳答案
这对我有帮助。
要在Gradle脚本中进行更改后刷新依赖关系,请在Gradle工具窗口中单击“刷新”按钮。
按下此按钮时,IntelliJ IDEA将分析项目结构,并在Gradle工具窗口中显示检测到的差异(如果有)。
我在jetbrains网站上找到了解决方案:Synchronizing Changes in Gradle Project and IntelliJ IDEA Project
关于java - 无法使用gradle设置json-smart,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31977085/