I’m experimenting with Buildship. I like the product, I like the name This is going to a great help to our teams.
I had a bit of trouble, which I solved with some digging. I write up my experiences here - for what it’s worth.
I had a multi-project build like this, imported into Eclipse with Buildship …
Root project ‘XYZappBuild’
— Project ':XYZutilUTIL’
… I want to add a project, to have this…
Root project 'XYZappBuild’
±-- Project ‘:XYZmainAPP’
— Project ':XYZutilUTIL’
I tried to create the new subproject in my Eclipse workspace using New -> Project -> Gradle Project and saw that it created a new root project containing the wrapper. This wasn’t right, so I removed the wrapper files then added my subproject project to the root project’s settings.gradle file.
I refreshed the tasks in the Gradle Tasks view, and saw my new project listed twice. Using the “Link with the explorer views” option in the Gradle Tasks view, I see that both project entries link to the same workspace project (highlighted in the Package Explorer view).
In /.metadata/.plugins/org.eclipse.buildship.ui/dialog_settings.xml I see both my true root project (XYZappBuild, initially imported into Eclipse), plus my new subproject (XYZmainAPP) created with the New Gradle Project wizard.
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
<section name="org.eclipse.buildship.ui.wizard.project.import">
<item value="/Users/rjt/Develop/buildshipTest/XYZappBuild" key="project_location"/>
</section>
<section name="org.eclipse.buildship.ui.wizard.project.creation">
<item value="/Users/rjt/Develop/buildshipTest/XYZmainAPP" key="project_location"/>
<item value="" key="custom_location"/>
<item value="true" key="use_default_location"/>
</section>
</section>
I removed the second <section>
(XYZmainAPP) and restarted eclipse, but the project is still shown twice in the Gradle Tasks view.
In the new (misbehaving) subproject’s .settings/gradle.prefs file, “connection_project_dir” refers to itself.
{
"1.0": {
"project_path": ":",
"project_dir": "/Users/rjt/Develop/buildshipTest/XYZmainAPP",
"connection_project_dir": "/Users/rjt/Develop/buildshipTest/XYZmainAPP",
"connection_gradle_user_home": null,
"connection_gradle_distribution": "GRADLE_DISTRIBUTION(WRAPPER)",
"connection_java_home": null,
"connection_jvm_arguments": "",
"connection_arguments": ""
}
}
This is different from my first subproject, wherein the grade.prefs “connection_project_dir” refers to the root grade project’s workspace directory as follows…
"project_dir": "/Users/rjt/Develop/buildshipTest/XYZutilUTIL",
"connection_project_dir": "/Users/rjt/Develop/buildshipTest/XYZappBuild",
I changed my new subproject’s “connection_project_dir” from "/Users/rjt/Develop/buildshipTest/XYZmainAPP” (itself) to "/Users/rjt/Develop/buildshipTest/XYZappBuild” (root project) and restarted eclipse. Now my Gradle Tasks view no longer shows the new subproject twice.
Questions…
- Is there a “Wizard” way to create a new Gradle subproject, rather than a new Gradle root project?
- Was there another way to repair the newly added subproject (initially added as a root project) so that it wouldn’t show twice in the Gradle Tasks view list?
Anyway, great job on Buildship. Thanks!
Richard