Dependencies for Eclipse projects located in git subdirectories


(Marco Paolieri) #1

I am working with Eclipse and egit: I have several projects, some of them checked out of git repositories (so, under a subdir of the workspace directory) and some not (so, right into the workspace subdirectory). My workspace looks like

/workspace/repo1/ProjectA

/workspace/repo1/ProjectB

/workspace/repo2/ProjectC

/workspace/ProjectD

I would like to be able to clone the projects hosted in repositories and generate .eclipse files (to compile within Eclipse as well), specifying at the same time dependencies between projects. So far, the best setup I’ve achieved requires creating a ‘settings.gradle’ such as

def path = [] as LinkedList

rootDir.traverse(

type: groovy.io.FileType.FILES,

nameFilter: ~/.+.gradle/,

maxDepth: 3,

preDir: { path << it.name },

postDir: { path.removeLast() }) { if (path) include path.join(":") }

I can then refer to projects like ‘:repo1:ProjectA’ or ‘:ProjectD’. Of course, this depends on the directory name I have used for the repositories (e.g., ‘repo1’), which should not be relevant. Is there a recommended setup for such situations?