Create a Google App Engine project in Eclipse with modules

I wrote a GAE app with Eclipse with Maven, as shown on cloud.google.com. Recently, I needed to use "backends" or another set of instances to handle a specific task. I found out that "backends" are deprecated in favor of "modules." I spent the last couple of days trying to configure the project to use modules and made very great progress.

All I want to do is split the URLs into different sets of instances (using modules and dispatch.xml). Does anyone know how I convert my existing Eclipse project for this? I am even ready to make a new project.

I need my modules for: 1) Use the common source code / classes from my source application 2) Have a different number of resident instances 3) Read the rules in dispatch.xml

I want my project to run in an eclipse and use either gradle or maven.

+6
source share
3 answers

I have the same problem, I decided to use this method.

Appstart ( https://github.com/omerio/appstart ), based on the multi-platform app Engine based on maven, demonstrating the use of technologies such as Guice, Jersey, Objectify, Cloud EndPoints and 3 modules - fronend module, base module and common a module that includes all common classes, including a model, that should show you an example of how to manage shared code. The folder contains the following maven modules / projects

  • Appstart backend
  • AppStart-General
  • Appstart ear
  • Appstart interface

The backend module contains only the code necessary for the backend, the interface contains the interface code, and the general module contains the general code. Projects are installed inside the parent folder "appstart" with the parent maven POM. The general module is included both in the interface and in the backend, using the maven dependency:

<!-- Common module dependency --> <dependency> <groupId>uk.co.inetria.appstart</groupId> <artifactId>appstart-common</artifactId> <version>1.0-SNAPSHOT</version> </dependency> 

When changing the general code, you can run mvn clean and then install it from the appstart-ear directory and update all dependent projects. Hope this helps

+5
source

What I ended up with was creating a new Enterprise Application Project in eclipse, copying my code and configuration to a new file structure, and then re-importing the project as a maven project. At the moment, everything looks fine.

+1
source

Here is a walkthrough of a multi-module project created using eclipse Kepler.

1) create mymodule1 as a regular dynamic web project

Set your target runtime: Google App Engine (xxx)

Install Add project to ear: selected

Name the EAR project: myear

This will create two eclipse projects, one of which is connected to the module, and the other to the ear file:

mymodule1

myear

In appengine-application.xml of both of these projects, set

 <application></application> 

both contain the name of your GAE project (for example, mygaeproject-11111) This name must already be created in the cloud console and will contain several modules.

2) In appengine-application.xml mymodule1 under

 <application>mygaeproject-11111</application> 

add ...

 <module>mymodule1</module> 

(Otherwise, you will get the "Multiple records with the same key" exception later)

3) In appengine-application.xml mymodule1 add the instance class that you want the module to work (inside appengine-web-app), for example:

 <instance-class>F2</instance-class> 

3) In the project menu, clear both mymodule1 and myear. You can now deploy myear to your local Google application server.

4) You will also need a default module to deploy to the production server, so create mymodule2 as a regular dynamic web project

Set your target runtime: Google App Engine (xxx)

Install Add project to ear: selected

Name the EAR project: myear

5) In appengine-application.xml mymodule2, set the following and set the instance class as before.

 <application>mygaeproject-11111</application> <module>default</module> 

6) In application.xml (Not appengine-application.xml) myear, set the context root associated with

 <web-uri>mymodule2.war</web-uri> 

to

 <context-root>default</context-root> 

7) Now clean and re-create everything and deploy to the local Google application server. If everything looks good, just right-click on the server in the server panel and select ... Deploy to remote server

8) If you later want to kill the project, select it in the cloud console, then go to the settings in the left panel and click "Disable application".

0
source

Source: https://habr.com/ru/post/978908/


All Articles