Hi to anyone,
some developers in our company work in the way, that they share all projects together in one big workspace, even the same project multiple times with different branches. This is possible doing projects without subprojects, checking them out in a folder, which contains the branch name. But we also have projects, which include some subprojects, e.g. having client/server/shared parts in different subprojects. There names are completely static due to having the root project as root of an git repo and the subprojects cannot contain the branch name.
Every time I try to import those projects, buildship tells me that there is already an project existing with the same name, which is completely the truth.
My question is: How can I handle to import different branches of the same module into eclipse as Gradle project? Can I somehow redefine the modulename, which is used by buildship? We also have project dependencies between let’s say server and shared, which still have to work…
Any ideas are very welcome
The project name might be fixed, but the project name in the Eclipse model can be changed. I’d suggest you add a branch name or the container folder name as a prefix. There’s an example in our FAQ how to do that: https://github.com/eclipse/buildship/blob/master/docs/user/Faq.md#q-a-project-with-this-name-already-exists-what-can-i-do
this was exactly what I was looking for.
I now have tried this - and I think this is only half the way.
Because the root project ist still named in a not unique way. I also cannot rename root project as this leads to another error. Is there a way to rename this or handle it in another way (e.g. to exclude the rootproject from getting imported to eclipse?) Because for us it is only a kind of a “container” for all the subprojects and doesn’t have any purpose in eclipse itself
I don’t have good news. For the time being, Buildship does require importing all projects in the workspace. We have the plan to introduce partial imports, but I don’t think it will happen in the next couple of months.
OK, and you also need the root project names to be named like the gradle root project? I tried to rename the root project as I do with the sub projects, but got an error… this is not an option either?
OK, I have found a solution, that might work for me… I set the name of the rootproject as well. Then I only have to use a foldername which equals this projectname, and it can be imported without errors.
I’m glad you found a solution.
However, I would like to explain a constraint in Eclipse and Buildship that might hit you. If you have a (root) project directly under the Eclipse workspace location, then you can’t do a rename. It is due to Eclipse’s rather bizarre behavior. If you rename any projects in the workspace root, then it will cause not only cause a change in the
.project file, but the entire project folder is moved to the
<workspace_loc>/<new_project_name> directory. This can easily mess up version control, therefore we decided to prohibit this use case in Buildship explicitly.
Ah - ok, that’s the reason why you rise this exception. Thank you for the info