New to Gradle, seeking help please

(Dan Royer) #1

Please forgive my ignorance. I’m an old coder and I don’t grok build systems. A dev contributed a gradle build file and it caused a “multiple inclusions” warning. I’m trying to migrate away from using pom.xml. I’m having troubles with which google can’t help.

The project is
The build file is

I’ve installed gradle and added “c:\Gradle 2.13\bin” to my windows10 PATH environment variable. I can run “gradle -v” from the command line.

Buildship offers a “build” task and runs but doesn’t create a new ./java/target/Makelangelo-[version]-with-dependencies.jar I’m expecting.

Eclipse no longer lets me debug the app, claiming it can’t find the main() in com.marginallyclever.makelangelo.Makelangelo.

Please: what do?

(Stefan Oehme) #2

You are trying to set up a multi-project build with this structure:

  |- java

Your settings.gradle should include your ‘java’ subproject.

include 'java'

Also, the build.gradle file for the java project seems to have been accidentally moved to the top-level of the repo. Also, don’t check in the .gradle directory, those are just local caches.

(Dan Royer) #3

I moved build.gradle to /java, and added the “include ‘java’” line. After refresh Eclipse doesn’t recognize my source and won’t build or run. On refresh gradle project I get

org.eclipse.buildship.core.GradlePluginsRuntimeException: Cannot include existing Eclipse project Makelangelo.
at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceOperations.includeProject(
at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.addExistingEclipseProjectToWorkspace(
at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.synchronizeNonWorkspaceProject(
at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.synchronizeGradleProjectWithWorkspaceProject(
at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.synchronizeGradleBuildWithWorkspace(
at org.eclipse.buildship.core.workspace.SynchronizeGradleProjectJob.runToolingApiJobInWorkspace(
at org.eclipse.buildship.core.util.progress.ToolingApiWorkspaceJob$
at org.eclipse.buildship.core.util.progress.ToolingApiInvoker.invoke(
at org.eclipse.buildship.core.util.progress.ToolingApiWorkspaceJob.runInWorkspace(
Caused by: java.lang.IllegalStateException: Workspace already contains a project with name Makelangelo.
at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceOperations.includeProject(
… 10 more

It also seems to be hiding my java/ folder from me in Eclipse, tho the folder is still on disk.

Github updated. Please: now what?

(Dan Royer) #4

no? Nothing? Please tell me what you need from me.

(Edmond) #5

I was able to import the project into Eclipse with Buildship without incident when I checked out ad3f317

I think you need to cleanup your workspace. Also due to the way you have setup the project, Java is a sub module but will show up as a top level project in the Eclipse workspace.

(Dan Royer) #6

@SagaciousZed I can also import. After that I cannot debug or build for release. The Java folder is missing from the project.

How would I clean the workspace?

I don’t know what the rest means.

(Dan Royer) #7

I’m sorry but I can’t continue to invest time on making this work. I’ve rolled back to the previous system (maven) and I’ll just have to live with it.

Good day, and thanks for all the fish.

(Edmond) #8

As far as I can tell, the build was working, just that your eclipse workspace needed to be clean up. The easiest thing to do is to create a new workspace instead of trying to fiddle with the existing one if you don’t know what to do.

And to say the last part another way, eclipse won’t display the Java folder as a folder with in the Makelangelo project, but as a separate project named Java