Preserving the Datastore when using App Engine dev server with Maven
Posted by David Chandler on June 25, 2011
Problem
I’m currently working on a GWT+GAE Maven project and the local datastore gets wiped every time I start the dev server, whether using mvn clean gae:run or Google Plugin for Eclipse.
Cause
Per the official dev server doc, the local datastore is stored in WEB-INF/appengine-generated/local_db.bin. For most Maven projects, the WEB-INF directory is located under target/${project.build.finalName}, so local_db.bin is under the target directory, which gets wiped every time you mvn clean. It also gets wiped when launching dev mode with Google Plugin for Eclipse.
Solution
Specify an alternate path to the dev server datastore.
In Eclipse, edit the project’s Run Configuration and add this to the VM args:
-Ddatastore.backing_store=${project_loc}/local_db.bin
This will put the local datastore in the project root directory, where it won’t get wiped every time you launch the dev server.
In the project’s POM, add this to the configuration section for maven-gae-plugin:
<jvmFlags> <jvmFlag>-Ddatastore.backing_store=${project.basedir}\local_db.bin</jvmFlag> </jvmFlags>
Many thanks to Marcel Overdijk for pointing the way on the maven-gae-plugin group.
Nikolay Rychkov said
Thank you very much!! That is it!
Configuring the App Engine development server « TurboManage said
[…] Preserving the Datastore when using App Engine dev server with Maven […]
mike corbridge said
Four years later …. do you know of a solution using a Gradle build system. I am using Android Studio 1.0.2, and I am taking advantage of the generators that create all the build scripts. But like everyone else, my local_db.bin is getting erased every time I make a change to my servlet.
Thank you
Mike
Toronto, Canada
jreim said
Still great info, thanks for keeping this up!