如何组织我的 Java 7 Eclipse GWT 项目?
对于后端(服务),我想使用 Java 7 和新的语言功能。对于前端来说这是不可能的,因为 GWT 编译器此时无法解析 Java 7 语言结构。所以我想设置两个 Eclipse 项目:一个用于 Java 6 的前端,一个用于 Java 7 的后端。知道如何进行构建(没有 Ant,仅在 Eclipse 中)和管理依赖项吗?
For the backend (services) I would like to use Java 7 and the new language features. For the frontend this is impossible, because the GWT compiler is unable to parse Java 7 language constructs at this point. So I would like to setup two Eclipse projects: One for the frondend with Java 6 and one for the backend with Java 7. Any idea how to do the build (no Ant, just in Eclipse) and manage the dependencies?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想你会想要三个项目。
1:使用GWT将代码编译为Javascript的前端项目。这应该使用 Java 6。
2:后端项目,它是纯 Java 的,可以使用 Java 7。
但是,他们需要共享一些代码(异步接口、数据结构等)。因此,您需要第三个项目:
3:包含共享代码的共享项目。这也应该使用 Java 6 和 GWT,并且应该定义一个 GWT 模块。因此,前端项目可以将该项目作为 GWT 模块引用,这应该会导致共享代码被编译为 Javascript。
即使它是 Java 6,后端项目也应该能够引用该项目。
I think you would like three projects.
1: The frontend project which uses GWT to compile code to Javascript. This should use Java 6.
2: The backend project, which is pure Java and can use Java 7.
But, they will need to share some code (async interfaces, data structures, etc). Therefore you need a third project:
3: Shared project which contains shared code. This should also use Java 6 and GWT and should define a GWT module. The frontend project can therefore reference this project as a GWT module and that should cause the shared code to be compiled to Javascript.
The backend project should be able to reference this project even though it is Java 6.
仅仅不在客户端和共享包上使用 java 7 功能还不够吗?我认为你不需要两个项目
我认为 GWT 可以在 Java 7 VM 上正常运行,并且 GWT 编译器不关心你的服务器包
Isn't it enough simply don't use java 7 features on your client and shared packages? I don't think you need two projects
I think GWT can run fine over a Java 7 VM, and the GWT compiler don't care about your server package
您应该能够在项目设置中设置项目的 Java。
在 Eclipse 中选择项目,然后选择 Project >特性。
Java 构建路径 >添加库。您可以添加/删除所需的 JRE。进行这些更改后,请确保 Java 编译器下的设置看起来也正确。
You should be able to set the project's Java in the project settings.
Select the project in Eclipse, then select Project > Properties.
Java Build Path > Add Library. You can Add/Remove the JRE you want. After those changes, make sure that the settings under Java Compiler look right too.