For example , If I want to make some extra changes to the imported gradle projects (imported by buildship plugin ) such as add my own project nature .
I know there is a extension point named org.eclipse.m2e.core.projectConfigurators in m2e plugin.
I’ve previously suggested that buildship should have similar hooks to the eclipse plugin
Eg:
apply plugin: 'buildship'
buildship.classpath.file {
withXml { ... }
whenMerged { ... }
}
buildship.project {
nature 'com.foo.MyNature'
}
Etc.
I think what Andy wants is an Eclipse extension point to provide additional capabilities for Buildship from an external plugin.
Yes we considered it, but our goal is to have a consistent product in Eclipse where the users don’t have to install anything separately. This doesn’t mean that you can’t extend Buildship: the project is open for external contributions. The generally accepted way for contributing is to create pull requests on GitHub.
Thanks donat , exactly that is what I want . I may send my pull requests later if necessary .
Hi @donat, whilst @AndyWu2015 did ask for an eclipse extension point, his example was to add a project nature, which my suggestion would be capable of doing (see example nature above).
Would you consider my suggestion? This would allow customising the .classpath
and .project
within the gradle script. I assume most buildship users are comfortable editing a gradle build script but it’s likely many of us have no idea how to write an eclipse plugin.
Other benefits include
- Since config is in a gradle script it’s committed to version control (git/svn)
- No need to install extra eclipse plugins on developer machines
Actually, we are working on exposing the builders/natures defined in the Eclipse Gradle plugin though the Tooling API module of Gradle. One done we’ll make use of it in Buildship in the next release.
Great! Will this give us a ‘hook’ to intercept/tweak the .classpath
and .project
files created by buildship?
Can we simply declare a section in our gradle build to do this tweaking?
No, with the new feature Buildship will only respect the natures defined in the Gradle DSL:
eclipse {
project {
natures 'some.extra.eclipse.nature', 'some.another.interesting.nature'
}
}
Great! Exactly what I was after (although I was suggesting a new buildship plugin rather than reusing the eclipse plugin’s model).
Will buildship honour the withXml
and whenMerged
closures?
Eg: https://docs.gradle.org/current/userguide/eclipse_plugin.html#N1434E
No, I don’t think the whenMerged
and the other closure will be supported. They are just workarounds to add extra configuration which not yet available via a Gradle DSL. One of Buildship’s goals is to fill these gaps by defining proper APIs in Gradle and consuming them in Eclipse.
Ah, so you’re supporting some of the eclipse plugin’s model but not all of it? That’s why I was suggesting a separate buildship plugin and model rather than confusing the two
apply plugin: 'buildship'
buildship.project {
nature 'com.foo.MyNature'
}