zeroturnaround/gradle-jrebel-plugin — pull request #1 by wujek-srujek (2012-10-27 11:57:47+00:00)
Title: Multi module fix

Hi. We are using gradle and jrebel, but we have a multimodule build and the generateRebel task is not robust enough. This pull request fixes a few issues with it and also makes the plugin slightly better and idiot-proof, I guess. Here a summary of changes:
* instead of creating directories like 'new File('src' + File.separator + 'main' + ...) gradle properties are used (for classes folders and for the webapp folder)
* the paths have been fixed - they were incorrectly pointing to /build/classes whereas they should point to /build/classes/main
* implements adding resources to rebel classpath
* as project.buildFile might return null (for modules that don't have a dedicated build.gradle), the logic to compute the project directory now uses project.projectDir, which is safe - this was the initial problem of ours, we got nulls and never knew why and where
* when rebel plugin was applied before war, it worked fine - the check for war succeeded and packaging was changed to 'war'; however, when war is applied after rebel, this failed as at the time of the check, the war plugin was not applied; this could happen in a single module when apply 'war' was after apply 'rebel', or in a multi-module build where the main build.gradle file configures plugins for all modules, and the modules then refine the configuration - if one of these modules is a webapp, applying 'web' would happen after rebel, and hence packaging was wrong
* as rebel makes sense for java projects only (and derivates, like groovy, war, ...), it now can tell the user at execution time that java plugin (or anything that applies it implicitly) was not applied; when JavaPlugin gets applied, the real task is configured - again, this makes configuration less error-prone as the sequence of plugin application is not important; additionally, users get build errors with messages on failure, not cryptic NPEs or 'missing property jar' or whatever
* continuing the previous one, generateRebel now depends on classes by default - it expects the sources to be compiled and resources processed, and only then does it build the classpath; this has the nice added value that it doesn't blindly add classes and res folder even if they don't exist (which might result in jrebel errors / warnings about missing folders when it starts) but rather checks whether the folders are there
* tests for most of the above

I tested this on multiple projects, single- and multi-module, and it works for all of them. I tested it using gradle 1.0, 1.1 and 1.2. I hope you could incorporate the the changes to the plugin so that others can benefit, and we don't have to rely on our internal artifacts ;d

Regards,
wujek