开发者

How to include external classes in a GAE deployment?

开发者 https://www.devze.com 2022-12-29 18:42 出处:网络
I am using the Google plug-in for Eclipse and have the following problem: The project (A) consists of a GWT based GUI talking to a server running on GAE and using JPA.

I am using the Google plug-in for Eclipse and have the following problem:

The project (A) consists of a GWT based GUI talking to a server running on GAE and using JPA. Additionally there is a project (B) to migrate the legacy data to the new datastore. Since these both project use a common data model, I have extracted a set of interfaces and enums into a separate project (C) and set the other two projects dependencies on it.

The Java App project (B) seems to work, but the GWT/GAE project (A) only works if I manually copy the classes into the WEB-INF/classes directory. Obviously this is only working when using the housted mode.

Anybody know开发者_StackOverflow中文版s how to configure such a multi project setup in Eclipse?

Also, I am not sure if the multi project layout is the best solution. The set of common model objects is used in all 3 areas:

  • user client (GWT project compiling standard folders client and shared)
  • server side (providing services for GWT-RPC, uploading and different feeds)
  • migration application (posting the legacy data to the upload servlet)

What are the architectural options to keep the amount of duplicated classes on minimum?


For your GAE project to work using another java project, first you have to add the second one to the first's one build path. This solves only one part of the problem, allowing you to reference the classes your need in development.

The other problem is that once you launch your GAE project in development mode, it will fail to find the other project's classes. What you need to do is export the project as a jar (the name doesn't matter, and the classes can be compiled or not) , and put ir in the WEB-INF/lib folder. You don't need to add the jar to the build path, you could keep using the project reference, but remember that everytime you make a change in the other project you need to export it and replace the jar with the new one. I haven't found a better way to doing it, but at least if you use this folder intead of WEB-INF/classes it will not be deleted by GAE.

As for the architectural options, I would put both the client and the server in one project, which would ease development. Then you could reference that project from your migration app. I think that way you will make easier to maintain your main project without affecting the other too much (I suppose the migration one will have a much shorter life span, so it isn't as important as the other in the long term).

0

精彩评论

暂无评论...
验证码 换一张
取 消