简体   繁体   中英

How to organize my Eclipse GWT project for Java 7?

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?

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM