Adding a subproject through New -> Project -> Gradle Project

I’m experimenting with Buildship. I like the product, I like the name :slight_smile: 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 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"/>

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.


  1. Is there a “Wizard” way to create a new Gradle subproject, rather than a new Gradle root project?
  2. 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!


Thanks, Richard! We will look into your feedback in more detail next week.

Are there any updates on this topic?

Regarding question 1: The current way to add a new sub-project is to add it to the settings.gradle file (manually) and to then trigger a refresh on one of the projects already imported into Eclipse (or to re-import the root project via import wizard). Buildship detects newly added Gradle projects and will configure them in Eclipse.

Currently, Buildship does not support adding Gradle sub-projects to an existing Gradle project via UI.

Regarding question 2: I suggest to remove the gradle.prefs file from the sub-project, remove the subproject from the workspace, remove the .project file, add the sub-project to the settings.gradle file, and do a refresh on the root project already imported into Buildship.

1 Like