Can we execute any Gradle script code before/after any Eclipse incremental or full build lifecycle?


(sebtardif) #1

Can we execute any Gradle script code before/after any Eclipse incremental or full build lifecycle?

I’m used to be able to workaround bug like GRADLE-1275 when using Maven in Eclipse using WTP m2e Eclipse integration. In the Maven world I can decide to run or not run any of the steps when in Eclipse, and we have a way to “prepare” files to be used when doing unpackaged deployment to the web or app server running in Eclipse, using or not “Serve modules without publishing”.

The following is the list of steps in Maven -> https://docs.sonatype.org/display/M2ECLIPSE/Project+build+lifecycle+mapping#Projectbuildlifecyclemapping-Introducenotionsof"interesting"and"notinteresting"mojoexecutions

What can I do in Gradle-Eclipse integration so that some of the file like MANIFEST are “prepared” before been made available to the web/app server running in Eclipse?


(Peter Niederwieser) #2

There isn’t currently any support for this. The longer term goal is to have the Eclipse Gradle tooling delegate all Eclipse build activities to Gradle, which will eliminate this class of problems. Meanwhile, if you can figure out a way to configure Eclipse so that it calls into Gradle during its build, you can configure the Gradle Eclipse tasks to generated the corresponding (XML) configuration. Alternatively, you may be able to configure the Gradle Eclipse tasks to include an output directory that contains the file(s) generated by Gradle. Or you make Eclipse deploy the Gradle-generated War. In the latter two cases, it may be necessary to manually invoke the Gradle build from time to time.