Git Product home page Git Product logo

Comments (24)

loosebazooka avatar loosebazooka commented on June 28, 2024 1

There's a little quirk here you should be aware of. Because the way the gradle plugin explodes applications, it will blow away the local datastore. If you want to persist the datastore you might want to pick an alternative location for the datastore file by adding another jvmFlag :

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

from gradle-appengine-plugin.

loosebazooka avatar loosebazooka commented on June 28, 2024 1

I think you can work around this. You might be able to have your own task that writes over the exploded-app directory the necessary files. This seems to work okay for me, try it out. Add this to your build file, and when you want to reload classes do a ./gradlew customReload it will pull any changes you made in to your classes and your webapp files (html/css/js and excluding the WEB-INF dir). It's a little complicated, but it should work for you.

import com.google.appengine.AppEnginePlugin

task reloadClasses (type: Copy) {
  from sourceSets.main.output
  into "${AppEnginePlugin.getExplodedAppDirectory(project)}/WEB-INF/classes"

  dependsOn classes
}

task reloadWebAppDir (type: Copy) {
  from (project.convention.getPlugin(WarPluginConvention).webAppDir) {
    exclude "WEB-INF/*"
  }
  into AppEnginePlugin.getExplodedAppDirectory(project)
}

task customReload {
  dependsOn reloadClasses, reloadWebAppDir
}

from gradle-appengine-plugin.

loosebazooka avatar loosebazooka commented on June 28, 2024

I haven't really investigated this, will add as an enhancement. Does it not work? What have you tried?

from gradle-appengine-plugin.

musketyr avatar musketyr commented on June 28, 2024

I guess the problem is that if you use this plugin you can no longer hot swap even the static files as it works on the regular dev server because the app is been running from build/exploded-app directory. there may be more solutions to do this, but I had to synchronize watch the resources for changes and synchronize them to exploded-app directory in Gradle Gaelyk Plugin.

from gradle-appengine-plugin.

thoutbeckers avatar thoutbeckers commented on June 28, 2024

Gaelyk runs in RAD mode by default, where you don't need to output to build/exploded-app and you can use the dev server's own mechanisms to hot swap.

from gradle-appengine-plugin.

musketyr avatar musketyr commented on June 28, 2024

not really. since version 0.6 we've switched from the original gradle-gae-plugin and we had to introduce new synchronization mechanism. actually, you can probably use it as well I don't think there is not that much specific things to gaelyk. the biggest problem with the old approach was that there is no way how to use old RAD with EAR based application.

from gradle-appengine-plugin.

thoutbeckers avatar thoutbeckers commented on June 28, 2024

Ah, I didn't know Gaelyk plugin worked around that, that's cool.

from gradle-appengine-plugin.

andresesfm avatar andresesfm commented on June 28, 2024

Could this be implemented based on the maven plugin? https://developers.google.com/appengine/docs/java/tools/maven

they basically add the flag "fullScanSeconds", very convenient

from gradle-appengine-plugin.

loosebazooka avatar loosebazooka commented on June 28, 2024

Yes, so I had a chance to look into this, hot code replace works with fullScanSeconds.

What you can do to enable this is manually add in the flag to jvm parameters in your build.gradle file and the appengineRun task will pass it on to the devappserver:

appengine {
  jvmFlags = ["-Dappengine.fullscan.seconds=5"]
}

Then if you want to update, run the gradle assemble task, it will then explode a whole new app and try to reload that.

from gradle-appengine-plugin.

mattburns avatar mattburns commented on June 28, 2024

Thanks @loosebazooka ! That sorted it for me and it'll do for now.
I would still like to not have to run gradle assemble in order to see the changes, so any other suggestions welcome.

I'm happy enough though. I've now moved my gae project from ant/ivy/eclipse, to gradle/intellij.
That's 2 days of faffing I won't get back ;)

from gradle-appengine-plugin.

mattburns avatar mattburns commented on June 28, 2024

Ahh, yes, so it does, I found it only does it on appengineExplodeApp, and not on assemble.

I hadn't noticed, thanks for the tip, that saved me a future headache :)

from gradle-appengine-plugin.

loosebazooka avatar loosebazooka commented on June 28, 2024

Yeah, assemble creates the .war file, but explode-app creates the exploded-app directory which the devappserver uses to run your application.

from gradle-appengine-plugin.

cypressious avatar cypressious commented on June 28, 2024

I set the JVM flag, started a local server via gradlew appengineRun and when I call gradlew assemble I get

:backend:appengineExplodeApp FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':backend:appengineExplodeApp'.
> Unable to delete file Path\To\Project\backend\build\exploded-app\WEB-INF\lib\appengine-api-1.0-sdk-1.9.20.jar

I'm on version 1.9.19. Any advice?

from gradle-appengine-plugin.

loosebazooka avatar loosebazooka commented on June 28, 2024

Are you running on windows by any chance? I wonder if something is loading that jar and windows doesn't allow it to be ovewritten/deleted.

from gradle-appengine-plugin.

cypressious avatar cypressious commented on June 28, 2024

@loosebazooka Exactly

from gradle-appengine-plugin.

cypressious avatar cypressious commented on June 28, 2024

Works great. Thank you very much!

from gradle-appengine-plugin.

marcosbozzani avatar marcosbozzani commented on June 28, 2024

@loosebazooka Thanks.

For me it was only working for resource files (.html/.css/.js), not for source files (.java). So I've added these two lines to the customReload task:

File appengineWebXml = file("${AppEnginePlugin.getExplodedAppDirectory(project)}/WEB-INF/appengine-web.xml")
appengineWebXml.lastModified = new Date().getTime()

Since I'm using gradle version 2.5, I've added the -t option when running the task:

gradle -t customReload

This way it's possible to just save the source/resource, hit F5 on the browser and see the changes.

from gradle-appengine-plugin.

mattburns avatar mattburns commented on June 28, 2024

Based on tips from @loosebazooka & @marcosbozzani, for non-windows users I suggest this:

appengine {
    appcfg {
        jvmFlags = ['-Ddatastore.backing_store=../../src/main/webapp/WEB-INF/appengine-generated/local_db.bin', '-Dappengine.fullscan.seconds=5']
    ...

And then :

gradle appengineRun
gradle -t assemble

That's the best I've come up with (updates web files and java and "enhances" the DTOs etc.) . It still takes ages to reload and blats away my Session (forcing me to re-login to my webapp) but it's the best I have... Improvement suggestions welcome

from gradle-appengine-plugin.

Robin-Hoodie avatar Robin-Hoodie commented on June 28, 2024

Has there been any progress on this issue? Would also be very interested

from gradle-appengine-plugin.

loosebazooka avatar loosebazooka commented on June 28, 2024

Currently the suggested mechanism is to follow the instructions in this
thread
On Jan 23, 2016 12:31, "Robin Hellemans" [email protected] wrote:

Has there been any progress on this issue? Would also be very interested


Reply to this email directly or view it on GitHub
#97 (comment)
.

from gradle-appengine-plugin.

tuna-einstein avatar tuna-einstein commented on June 28, 2024

Jus run

./gradlew appengineExplodeApp

It should reload everything.

from gradle-appengine-plugin.

mattburns avatar mattburns commented on June 28, 2024

I previously said to use gradle -t assemble but this just spins in a cycle for me now. I'm pretty sure it's because it monitors the classes directory for changes then triggers appengineEnhance on so it goes in an infinite loop of rebuilding. Any suggestions?

from gradle-appengine-plugin.

loosebazooka avatar loosebazooka commented on June 28, 2024

It looks like --continuous might not work well with data nucleus. Maybe you
could muck around with the task up to date checks to get this working. But
you might just have to initiate the rebuild yourself... :/

On Jul 22, 2016 08:12, "Matt Burns" [email protected] wrote:

I previously said to use gradle -t assemble but this just spins in a
cycle for me now. I'm pretty sure it's because it monitors the classes
directory for changes then triggers appengineEnhance on so it goes in an
infinite loop of rebuilding. Any suggestions?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#97 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABPo-smkIUzH1oyUyo8CcXYC-06I67mYks5qYN3ogaJpZM4B_Ry5
.

from gradle-appengine-plugin.

JFL110 avatar JFL110 commented on June 28, 2024

Hi all, I've built a standalone application that 'solves' this problem by monitoring the IDE build output directories and copying the class files to the WEB-INF directory. It allows you to make changes to the source code of the main project and dependencies and have those changes applied in a couple of seconds with no restart. Contributions welcome!
https://github.com/JFL110/gae-hot-reloader

from gradle-appengine-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.