Is there a way to have a custom RepositoryHandler?

I’d like to use P2 repositories.

I assume that what you want is a custom repository, not a custom repository handler. I don’t think that’s currently possible, at least not without touching internals or making changes to the Gradle codebase. If you are interested in contributing to Gradle, it would be best to continue this discussion on the dev mailing list.

Thanks for your answer. I found this project [https://github.com/Ullink/gradle-repositories-plugin] that seems to add “repositories” like sourceforge. As far as I can see it uses the metaClass to add methods to the RepositoryHandler for resolving Artifacts.

The essential part is how to implement the repository (not how to add new methods to ‘RepositoryHandler’). The plugin seems to do a good job, but unfortunately, Ivy resolvers have been deprecated and will be removed in 2.0.