Java dependencies on a "war" style project not recognized

If I create a basic “war” style project with build.gradle that applies the “war” plugin and import this into eclipse using latest buildship it loads fine and correctly configures all of the src folders and java dependencies in the classpath container. But when I try to load a project that uses another gradle plugin “com.liferay.plugin”, which dynamically configures/loads the war plugin internally, and when buildship loads this project during import it doesn’t configure it as a java project. I assume that is because this new plugin is doing something to the gradle model that when buildship reads it, it doesn’t see it as a java project.

I’m an eclipse plugin developer so I would like some help from buildship team to point me to where this code is located, where buildship analyzes the gradle project model to find out if the project is a java project and then takes appropriate action? I can try to debug this and find out more info.

Thanks.

In Buildship the Gradle-Eclipse project model synchronization is handled by the DefaultWorkspaceGradleOperations class. The implemented interface is well documented, check out that one too.

If you dig into this class, you’ll see that Buildship only has an approximation to determine if a project is a Java project: if there is at least one source folder, then the Java nature is added.

Ok I see the problem. In my example the project I was importing already
had a .project and so buildship didn’t try to setup a new java project and
modify the classpath, etc. I just deleted the .project and then
re-imported it and it seems to be working as expected.

I’m glad you could find the source of the problem. FYI sometime soon we’ll add an option to perform clean imports If you’ll enable this options the import will explicitly delete Eclipse descriptors before adding projects to the workspace.