[GRADLE-1677] Apply a plugin and add it's classpath dependency directly via a single Project.apply statement Created: 16/Jul/11 Updated: 10/Feb/17 Resolved: 10/Feb/17 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | New Feature | ||
Reporter: | Merlyn Albery-Speyer | Assignee: | Unassigned |
Resolution: | Won't Fix | Votes: | 1 |
Description |
Motivation I'd like to make it easier for third party plugins to be integrated into Gradle builds. Right now plugins either need to insist on an internet connection in order to apply a script, or the contents of that script needs to be inlined. "apply plugin: 'xxx'" is so much cleaner than bulky build script dependencies configurations with funky GitHub Ivy resolvers. Getting plugins added to maven central is enough of an obstacle that no-one does it. So, these are the motivating pain points for me. Solution Being able to inline the dependency declaration into the apply statement is something we've discussed before. The plan is to have the apply statement handle dependency coordinates. You would be able to do any of the following: 1. apply group: 'mygroup', name: 'myplugin-project', version: '1.0', plugin: 'myplugin' Option 1. would resolve 'mygroup:myplugin-project:1.0' using buildscript.repositories, then scan the resolved artifacts (but probably not their dependencies) for a plugin with id 'myplugin', which it would then load and apply. Option 2. would use the plugin id as the dependency project name, and resolve 'mygroup:myplugin:1.0' using buildscript.repositories. Option 3. would work as it currently does now. That is, it scans the build script classpath for a plugin with id 'myplugin' What this means is that instead of: buildscript { } apply plugin: 'myplugin' You would do: apply group: 'mygroup', plugin: 'myplugin', version: '1.0' ... I think there are really 2 options to solving this: I'd go with option 2. The apply method would work something like this: Nice and simple. It might be good to have a cache of classloaders created in step 2, so we can share the implementation classes across all projects in a build (and, when using the daemon, across builds). What is interesting about this approach is that plugins are isolated from each other. The big downside is that the plugin cannot contribute classes to the build script. But I think it might be a good thing to move away from needing to do this. |
Comments |
Comment by Merlyn Albery-Speyer [ 16/Jul/11 ] |
I'm working on a candidate solution for this. |
Comment by Merlyn Albery-Speyer [ 16/Jul/11 ] |
Relates to http://issues.gradle.org/browse/GRADLE-1653 somewhat. |
Comment by Benjamin Muschko [ 15/Nov/16 ] |
As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub. We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to. Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:
We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle! |
Comment by Benjamin Muschko [ 10/Feb/17 ] |
Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved. |