Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom datastore location on local machine with App Engine

I'm developing App Engine application in Android Studio and testing it on my local machine (with local datastore). It's Java based app. Every time I re-run the server the local datastore is cleared. I've found several solutions for Python developers but it looks like there's no answer for Java.

Android Studio allows only to change:

  • WAR Path
  • VM Args
  • Server Address
  • Server Port

I've tried with VM args but these are for Java VM not for the app server obviously. Is there a way to persist local datastore across server restarts? It would be perfect If I could run this configuration directly from Android Studio.

like image 291
tomrozb Avatar asked Aug 16 '14 10:08

tomrozb


Video Answer


2 Answers

The local datastore gets cleared because it is by default located in the application exploded war directory (which is deleted in its entirety on every build).

Instead of having to running the dev server manually from a terminal, you can actually just add a VM arg to the appengine run configuration to locate the datastore in another location:

-Ddatastore.backing_store="/path/to/datastore/file/location/local_db.bin"

(Solution found on: https://code.google.com/p/android/issues/detail?id=68225)

like image 50
Arjan Mels Avatar answered Nov 15 '22 16:11

Arjan Mels


Like Arjan says, you can use -Ddatastore.backing_store.

If you use Android Studio 1.5, modify build.gradle. On appengine put the paramater jvmFlags. Example:

 appengine {
  downloadSdk = true
  appcfg {
    oauth2 = true
  }
  jvmFlags = ["-Ddatastore.backing_store=\"D:/temp/local_db.bin\""]
}
like image 42
mabg Avatar answered Nov 15 '22 16:11

mabg