Implementing a custom Task without depending on Gradle's internals

@Andy_Wilkinson I have been looking into the compatibility problem that concerns using ProjectBuilder for plugin testing:

https://discuss.gradle.org/t/cannot-apply-spring-boot-gradle-plugin-in-own-plugin-with-gradle-3-0

[#GRADLE-3558] Applying a plugin built with Gradle 2.x through ProjectBuilder can't find internal classes

It is now fixed for Gradle 3.2. I am not sure from the conversation if that is the major concern for you or only one of many. But if you think this might solve some of your issue already, I would encourage you to try it out by running the corresponding tests with our latest nightly. If you have feedback, we can put further effort into improving this for 3.2. And if you have other concrete issues with reproducible examples, which are not covered by this, please share them.

The test that is part of the fix also contains a workaround to make the project builder tests work with 3.0 / 3.1 if that is a concern for you: