Using the Buildship plugin to create a new gradle project in eclipse, it insists on creating a root project. Is there any way to get around this and create a sub-project from the start with Buildship? If not, what do you suggest as best practise for our developers when creating a new sub-project in eclipse? By subproject, I mean an eclipse project that is part of a multi-module build whose root is some other project.
There is currently no plan for a âcreate subprojectâ feature.
You can switch the âProject Explorerâ to âHierarchicalâ view. The âPackage Explorerâ doesnât support this unfortunately. This is not something Gradle can change, itâs part of the Eclipse Platform.
I donât understand the âno plansâ comment. There is a real need to use sub-projects, but weâve been asking for that feature in Eclipse since Europa.
However, here are the steps to create sub-projects:
In your root project:
Create a sub-folder, named appropriately.
Edit settings.gradle and âincludeâ that folder as a sub-project.
Do a Refresh Gradle Project.
In the new sub-folder (project):
Create a build.gradle file.
Edit it and add âapply plugin: âeclipseââ.
If you are creating a Java project, also add âapply plugin: âjavaââ.
Save the file.
In the Gradle Tasks view:
Refresh the view (toolbar button).
Run the âeclipseâ task, under âideâ, on your sub-project.
In the Pacakge Explorer
Refresh the root project.
This will move the sub-project to the root level (Eclipse limitation).
This will also move the new project out of any working set that you had selected. So use the Assign Working Sets to fix it.
In your sub-project:
If it is a Java project, do a Refresh Gradle Project. This will add the â.classpathâ file.