Multibuild projects do not work with Buildship

Hello. I am trying to deploy two WAR projects using Gradle 2.5-rc-2 on:
Java 8
WildFly 9
Eclipse Mars 4.5

Using Buildship Gradle Integration 1.0.1, I’ve created three basic Gradle projects:

multi-main

And configured them to work as multibuild. Compliation works, generated WARs works, but… using Gradle->Refresh on project “multi-main” (or any other for that matter) does NOT work correctly. It hides “/src/main/java” and “/src/test/java” source directories and do nothing to “Project and External Dependencies”. It makes any useful work impossible.

Additionally, if I add lines like

war {
archiveName = ‘multi-project1.war’
}

to build.gradle in subprojects, Gradle->Refresh throws exception: http://i.imgur.com/V23E92l.png
Full exception stack: http://pastebin.com/eyjcrCBC

I can send entire packed workspace, if needed (Eclipse beside Buildship uses JBoss Tools 4.3.0.Beta1).

Looks like “Buildship Gradle Integration” is incapable of dealing with multibuild projects.

I recreated the file structure you described above and for me the import worked without any problems. I have a few notes though:

  • When importing a project you should specify the folder with the settings.gradle file inside. In this case it is the multi-main folder.
  • Buildship has a - not really precise - assumption that if a project has at least one Java source folder then it is a Java project and a Java nature should be added. But if the folder doesn’t exists physically, then the tooling API will return an empty list of source folders and the project won’t have the nature. To resolve it simply create the src/main/java folder and try to do an import again.
  • A minor thing which could be important: if your project has a .project file, then Buildship leaves everything as it is. Consequently if you can’t reproduce the import twice, think about deleting the .project files first.

Thanks for answering!

I do not see any option like that. Note: I am using “File->New->Project… Gradle->Gradle Project” option (create Gradle project from scratch), not import of already existing project. And I think presence of settings.gradle file would be sufficient information for determining root project anyway.

[quote=“donat, post:2, topic:10595, full:true”]

  • Buildship has a - not really precise - assumption that if a project has at least one Java source folder then it is a Java project and a Java nature should be added. But if the folder doesn’t exists physically, then the tooling API will return an empty list of source folders and the project won’t have the nature. To resolve it simply create the src/main/java folder and try to do an import again.[/quote]
    This folder exists physically - Buildship created it during creating whole project. It exists all the time, I didn’t touched it.

[quote=“donat, post:2, topic:10595, full:true”]

  • A minor thing which could be important: if your project has a .project file, then Buildship leaves everything as it is. Consequently if you can’t reproduce the import twice, think about deleting the .project files first.[/quote]
    I do not think it is applicable, since I created project from scratch using “Gradle->Gradle Project”. No importing of already existing project was involved.

Steps to reproduce problem:

Assume we have computer with Java 1.8. Download Eclipse Mars 4.5. Using Eclipse Marketplace install Buildship Gradle Integration 1.0.

I noticed that Buildship on Marketplace seems to be 1.0, not 1.0.1. If it really 1.0.1, as assured in this thread, I can’t confirm it. Further steps are done assuming it is in fact newest version, but you guys may want to clear it up.

After Eclipse restart, create three projects (note it is flat structure, not nested) using File->New->Project… and selecting Gradle->Gradle Project. Names are ‘multi-main’, ‘multi-project1’ and ‘multi-project2’. Delete settings.gradle from multi-project1 and 2. Override build.gradle and settings.gradle as shown in linked pastebins in first post.

Using Gradle->Refresh Gradle project on any of these three projects will make src directories invisible, despite fact that physical directories are still present. No changes to “Project and External Dependencies”.

I have no clear idea what is wrong. Maybe Eclipse Marketplace has obsolete version (1.0), since there is bug report that sounds suscipiously similiar to one part of my problem (src directory vanishing).

Other possibility is that there was not much attention to “create project from scrach” feature and focus was on handling import of existing projects. So creating project from scrach may be buggy or simply can’t handle multibuilds yet if they have flat structure. I didn’t test it using nested structure, since I prefer flat.

Please note that the project creation wizard is only intended for ‘getting started’-like scenarios and - as you said - is not for setting up multi-project setups. In this case I’d suggest to create a project structure externally and then import it into Eclipse afterwards.

The Eclipse marketplace points to the http://download.eclipse.org/buildship/updates/e45/releases/1.0 URL which is an aggregate update site. When you install Buildship, the update mechanism will always choose the latest available version which is now the 1.0.1 release.

Thank you for reply.

Currently Buildship allows for creating stand-alone projects.

Are there plans to allow creating multibuild projects (both flat and nested) from scrath with Buildship in future?

As is, I feel that this detail in Buildship is incomplete.

There are currently no plans for this. We plan to extend the Gradle core to generate more types of projects (like multi-project, for example). Once done in Gradle core, we can leverage this in Buildship.