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 https://github.com/MarginallyClever/Makelangelo/tree/dev
The build file is https://github.com/MarginallyClever/Makelangelo/blob/dev/build.gradle

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:

makelangelo
  |- 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(DefaultWorkspaceOperations.java:199)
at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.addExistingEclipseProjectToWorkspace(DefaultWorkspaceGradleOperations.java:209)
at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.synchronizeNonWorkspaceProject(DefaultWorkspaceGradleOperations.java:191)
at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.synchronizeGradleProjectWithWorkspaceProject(DefaultWorkspaceGradleOperations.java:109)
at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceGradleOperations.synchronizeGradleBuildWithWorkspace(DefaultWorkspaceGradleOperations.java:70)
at org.eclipse.buildship.core.workspace.SynchronizeGradleProjectJob.runToolingApiJobInWorkspace(SynchronizeGradleProjectJob.java:71)
at org.eclipse.buildship.core.util.progress.ToolingApiWorkspaceJob$1.run(ToolingApiWorkspaceJob.java:74)
at org.eclipse.buildship.core.util.progress.ToolingApiInvoker.invoke(ToolingApiInvoker.java:54)
at org.eclipse.buildship.core.util.progress.ToolingApiWorkspaceJob.runInWorkspace(ToolingApiWorkspaceJob.java:71)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.IllegalStateException: Workspace already contains a project with name Makelangelo.
at com.google.common.base.Preconditions.checkState(Preconditions.java:150)
at org.eclipse.buildship.core.workspace.internal.DefaultWorkspaceOperations.includeProject(DefaultWorkspaceOperations.java:179)
… 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