Eclipse not recognizing Gradle dependencies(Eclipse 无法识别 Gradle 依赖项)
问题描述
我是 Gradle 新手,我正在尝试本教程
还有办法吗?
你应该使用 gradle eclipse 插件.将此添加到您的 build.gradle 文件中:
应用插件:eclipse"这会将与 Eclipse 相关的任务添加到您的构建中.通过执行
gradlew cleanEclipse eclipseGradle 将根据项目的当前依赖关系重新生成所有 eclipse 项目和类路径文件.但是,您需要刷新 IDE 以使更改可见.
还有一件事需要考虑.由于 eclipse 并没有真正意识到 gradle 依赖项——它只通过生成的类路径文件知道它们——新的依赖项只有在重新生成这些文件后才能对 eclipse 可见.此外,在 eclipse 中添加的依赖项对您的 gradle 构建不可见,并且在重新生成类路径文件后将被删除.
I am new to Gradle and I was trying this tutorial https://spring.io/guides/gs/rest-service/ I was able to compile the jar with the required dependencies and run it. However, I find it annoying that the libraries are not recognized by the IDE.
Is there anyway to do it?
You should use the gradle eclipse plugin. Add this to your build.gradle file:
apply plugin: "eclipse"
This will add eclipse related tasks to your build. By executing
gradlew cleanEclipse eclipse
Gradle will regenerate all eclipse project and classpath files based on the current dependencies of your project(s). You will however need to refresh your IDE to make the changes visible.
There is one more thing to consider. As eclipse is not really aware of the gradle dependencies - it knows them only by the generated classpath files - new dependencies will be visible to eclipse only after regenerating these files. Furthermore dependencies added in eclipse will not be visible to your gradle build and will be removed once the classpath files are regenerated.
这篇关于Eclipse 无法识别 Gradle 依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Eclipse 无法识别 Gradle 依赖项
基础教程推荐
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
