4

I know that Google support password-less GAE app uploads using appcfg.{sh,cmd], as described here: https://developers.google.com/appengine/docs/java/tools/uploadinganapp#Passwordless_Login_with_OAuth2

However, I would like to know if I can do the same using Google's official Maven GAE plugin. There is a goal called appengine:update that is used for uploading the local GAE app to the cloud. However, I cannot find information anywhere as to whether this will support OAuth2. Anyone know how I can combine OAuth2 and this Maven plugin?

The reason why is because I am using Jenkins to build my project and I would much rather prefer to upload my application automatically using a Maven goal during the build instead of running a script (more complex than Maven goal) as a post-build step.

ecbrodie
  • 11,246
  • 21
  • 71
  • 120
  • 1
    As a workaround when I deploy I use an account spec just for appengine uploads. The one approach that I found useful was to make an account spec for the app uploads and use that account only for uploading application and nothing else. – Niklas Rosencrantz Jun 04 '13 at 23:58

2 Answers2

6

It seems that it have been improved in recent versions of GAE Maven plugin (no appcfg invocation necessary). It is enough to invoke:

mvn clean appengine:update

if there is no ~/.appcfg_oauth2_tokens_java it will pop your browser, and will ask for credential to Google Account. After successful authentication you are presented with OAuth2 token. Paste it in the terminal window, where you invoked mvn and you're done.

Bart Prokop
  • 422
  • 4
  • 7
  • Ya, I"ve noticed that recently. Great that they added this feature. – ecbrodie Nov 20 '13 at 14:16
  • In my case browser is not opening. What should i do? – Niranjan Jan 31 '15 at 08:49
  • I haven't dealt with GAE in almost a year now. But IIRC, the Maven goal will print out a URL that you should paste into a new browser window yourself and Maven will wait for you to input the code you get from the browser. – ecbrodie Feb 01 '15 at 17:43
  • @ecbrodie I saw this info https://cloud.google.com/appengine/docs/java/tools/uploadinganapp#Passwordless_Login_with_OAuth2, From this i understood that if browser not opening appcfg.sh will show a url to paste in browser how can access this please tell me. I am new to app engine. – Niranjan Feb 02 '15 at 16:23
0

It appears that appengine:update automatically supports OAuth2. I just had to run a manual build with appcfg.sh. If that shell script was on your PATH, then the command looks something like this:

appcfg.sh --oauth2 update myapp/war-directory

Once I follow the manual steps to deploy my app and download the OAuth2 token for my user, I can run mvn appengine:udpate. This will detect my OAuth2 token and not require any manual interaction.

ecbrodie
  • 11,246
  • 21
  • 71
  • 120