Awesome. Thanks so much. That worked great!
Only minor problem was that I hardcoded a special case for log4j, but I can
live with that for now. The other thing is that the libraries all show up
in a big list in the Eclipse project that can't be collapsed like you can do
with Maven, but I think the only way around that is to write an Eclipse
plugin.
/**
* Prints classpath entries for Eclipse's .classpath file
* The Eclipse plugin forces each Gradle subproject to be its own Ecilpse
project,
* so we do this instead so that we can have everything in one Eclipse
project.
*/
task printClasspath << {
cp = new java.util.TreeMap()
subprojects.each {
it.configurations.testRuntime.resolvedConfiguration.firstLevelModuleDependencies.each
{
addDepToCp(cp, it)
it.children.each { addDepToCp(cp, it) }
}
}
cp.each { println it.value }
}
def addDepToCp(cpSet, dep) {
if (project.group.equals(dep.moduleGroup)) {
return
}
jarName = dep.moduleName + '-' + dep.moduleVersion
lib = '/home/' + System.getenv()['USER'] + '/.gradle/cache/' +
dep.moduleGroup + '/' + dep.moduleName + '/jars/' + jarName + '.jar'
source = lib.replace('jars', 'sources')
if (dep.moduleGroup.equals('log4j')) {
lib = lib.replace('jars', 'bundles')
}
entry = '\t<classpathentry kind="lib" path="' + lib + '" sourcepath="' +
source + '"/>'
cpSet.put(jarName, entry)
}
--
View this message in context:
http://gradle.1045684.n5.nabble.com/How-to-use-the-Eclipse-plugin-with-a-multi-project-build-tp3370505p3371401.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email