Grails项目 - Eclipse中常见的Java项目依赖关系 [英] Grails Project - Common Java Project Dependency in Eclipse

查看:171
本文介绍了Grails项目 - Eclipse中常见的Java项目依赖关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有,



我们有标准的java项目,包含我们通用的数据模型,常见的实用程序类等...



我似乎无法想象的是如何使我的Grails项目(在Eclipse中)与工作空间中的其他标准(非Grails)java项目有依赖关系。当我在Java构建路径中添加项目时,该项目不会显示任何编译器错误,但是当我运行Grails工具 - >刷新依赖关系或尝试运行项目(run-app)时,它将失败。 / p>

这似乎是一件很常见的事情,但是我已经在网络上搜索,并且无法找到解决方案。我们没有在我们的环境中使用maven。由于我们在客户端构建Eclipse RCP应用程序,因此我们使用OSGI清单来管理我们的项目/捆绑依赖关系。

解决方案

您可以使用链接的源目录将Java或Groovy依赖项包含在grails项目中,您需要设置输出目录到Project / target / classes(这些配置进入Java Build Path选项中的grails项目首选项 - > Source Tab)。



输出目录中的更改允许Eclipse检测依赖关系的更改,并在使用grails run-app运行应用程序时自动加载它。



您可以使用自动完成并使用此配置调试依赖项的源。



我准备了一个包含Java截图的步骤和步骤过程和Groovy 这里


All,

We have standard java projects that contain our common data model, common util classes, etc...

What I can’t seem to figure out is how, to make my Grails project (in Eclipse) have a dependency on the other standard (non Grails) java project in the workspace. When I add the project in the "Java Build Path" the project doesn’t show any compiler errors, but it when I run "Grails Tools -> Refresh Dependencies" or attempt to run the project (run-app) it fails.

This seems like it would be a pretty common thing, but I have searched all over the web and have been unable to find a solution. We are not using maven in our environment. Since we build Eclipse RCP applications on the client side, we use OSGI manifests to manage our project / bundle dependencies.

解决方案

You can use linked source directories to include the Java or Groovy dependencies in the grails project and you need to set the output directory to Project/target/classes (these configurations go into the grails project preferences in Java Build Path options -> Source Tab).

The change in the output directory allows Eclipse to detect changes in the dependencies and auto load it when running the app using grails run-app.

You can use autocomplete and debug the sources of the dependencies with this configuration.

I prepared a step and step process that includes screenshots for Java and Groovy here

这篇关于Grails项目 - Eclipse中常见的Java项目依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆