To create a new project, you'll need to use an App Engine-provided Maven App
Engine artifact called appengine-skeleton-archetype
, as described in
Creating the project. The App Engine Maven artifact is
what creates the project layout and files required to deploy and run on App
Engine.
For more on using Maven with App Engine, see the Using Apache Maven Guide. As an alternative to Maven, you could instead use Eclipse via the Google Plugin For Eclipse or you could use Apache Ant.
Creating the project
To create the project:
-
You'll need an application ID (project ID) in order to deploy your app to production App Engine. Create a new project as follows:
- Visit Google Developers Console in your web browser, and click Create Project.
- Supply the project name Guestbook and accept the project ID that is auto-generated for you.
- Click Create.
Make a note of the project ID, since you'll need to supply it as the application ID in the next step.
-
Change to a directory where you want to build your project and invoke Maven as follows:
mvn archetype:generate -Dappengine-version=1.9.18 -Dapplication-id=your-app-id -Dfilter=com.google.appengine.archetypes:
replacing
your-app-id
with the project ID value you obtained in the previous step. The Mavenarchetype:generate
command creates a new project with directories and files from the archetype you specify in this procedure. Note that the values you supply here and elsewhere in the remaining steps in this procedure are used in thepom.xml
andappengine-web.xml
files generated in the directories shown in the screencap located at the end of this procedure. -
Select from the artifact list by entering the value
1
, which specifies the archetypecom.google.appengine.archetypes:appengine-skeleton-archetype
. -
Select the most recent version from the displayed list of available archetype versions by accepting the default.
-
When prompted to
Define value for property 'groupId'
, supply the desired namespace for your app; to keep this tutorial in sync with the source files at GitHub, specifycom.example.guestbook
. -
When prompted to
Define value for property 'artifactId'
, supply the desired project name; to keep this tutorial in sync with the source files at GitHub, useguestbook
. -
When prompted to
Define value for property 'version'
, accept the default value. -
When prompted to
Define value for property 'package'
, supply your preferred package name (or accept the default). The generated Java files will have the package name you specify here. Note that the source files at GitHub use the package namecom.example.guestbook
, so you should use that as the package name if you want to keep in sync with the sample source. -
When prompted to confirm your choices, accept the default value (
Y
), and wait for the project to finish generating. -
Change directory to the new
guestbook
that you just created. -
At this point you won't have any source code. But build the project anyway to download any required libraries by invoking
mvn clean install
-
Wait for the project to build. When the project successfully finishes you will see a message similar to this one:
[INFO] -------------------------------------------------- [INFO] BUILD SUCCESS [INFO] -------------------------------------------------- [INFO] Total time: 1:16.656s [INFO] Finished at: Mon Sep 15 11:42:22 PDT 2014 [INFO] Final Memory: 16M/228M [INFO] --------------------------------------------------
-
Examine the project layout:
- You'll add your own application Java classes to
src/main/java/...
- You'll configure your application using the file
src/main/webapp/WEB-INF/appengine-web.xml
- You'll configure your application deployment using the file
src/main/webapp/WEB-INF/web.xml
We'll describe what to do inside these subdirectories later.
- You'll add your own application Java classes to
You are now ready to add your own application code and UI.