How to run a gradle task from a java code?

In fact, from my Gradle project I manipulate other gradle projects; and I want to be able to run the eclipse task (the gradle eclipse plugin) on those Gradle projects so that those projects can be opened from eclipse, I hope you understand my problem