Buildship uses folder name based on settings.gradle project name

I am importing a Gradle project into Eclipse 4.2 using Buildship 1.0.1.v20150707-1007-m. The project root name is set in settings.gradle and does not match the Subversion folder name. The checkout is using the folder as named in SVN. The import as a Gradle project works fine and the tasks are listed, but another folder is created with the project name specified in settings.gradle. The Eclipse project files are there and the source folder names, the latter being empty.

When I try to run a task a failure occurs stating that the ‘check’ task does not exist. This also happens with the ‘build’ task. The console output is:

Gradle Tasks: check
Working Directory: C:\workspace\spa\ebs-laptop-encryption-signature-portlet
Gradle Distribution: Gradle wrapper from target build
Gradle User Home: C:\.gradle
Java Home: C:\Program Files\Java\jdk1.7.0_40
JVM Arguments: Use default defined by Gradle
Program Arguments: None
Parallel execution is an incubating feature.
FAILURE: Build failed with an exception.
* What went wrong:
Task 'check' not found in root project 'ebs-laptop-encryption-signature-portlet'.
* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 0.134 secs

Is it required for the folder name and project name to match?

This looks clearly like a bug to me. I’ve raised this issue at the buildship bugzilla: https://bugs.eclipse.org/bugs/show_bug.cgi?id=472223. I keep you posted on updates for this issue. This might take a while due to most of the buildship devs are currently on holiday.

As René said we were on holidays and have a few tasks stacked up. Would it be possible for you to assemble a small sample project which reproduces the problem? With that we can test/fix the issue faster.

I added a ZIP file to the bugs.eclipse.org report.

Copied from Bugzilla:

If any project located directly under the Eclipse workspace folder, then the project name has to be the same as the folder’s name. If the project is renamed, then the container folder is also renamed.

Because of this, Buildship can’t provide custom names for the root projects when they are imported from the workspace folder. To leverage that we simply keep the original name for the Eclipse root project in this use case.

The implementation from the pull request #148 has been merged to master and is part of the latest snapshot for testing: http://download.eclipse.org/buildship/updates/e45/snapshots/1.0/

Updated from the snapshot repo and this is working well. Thanks!