From d183c605ac9ef3e32a4c96b779a5665f2525a4cc Mon Sep 17 00:00:00 2001 From: Siedlerchr Date: Thu, 5 Sep 2019 09:35:06 +0200 Subject: [PATCH] Make JabRef work in eclipse This is the only change (plus the manual configuration) --- eclipse.gradle | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/eclipse.gradle b/eclipse.gradle index 6fa381b3fe7..eeaa9f4895f 100644 --- a/eclipse.gradle +++ b/eclipse.gradle @@ -11,17 +11,39 @@ eclipseJdt.doLast { f.append('encoding/=UTF-8') } eclipse { -//add libraries to module path: https://github.com/eclipse/buildship/issues/620#issuecomment-390469550 - classpath { + project { + natures 'org.eclipse.buildship.core.gradleprojectnature' + } + + classpath { file { whenMerged { - entries.findAll { - it.kind == 'src' || it.kind == 'lib' - }.each { it.entryAttributes['module'] = 'true' } + entries.findAll { isModule(it) }.each { //(1) + it.entryAttributes['module'] = 'true' + } + + entries.findAll { isSource(it) && isTestScope(it) }.each { + it.entryAttributes['test'] = 'true' + } + + entries.findAll { isLibrary(it) && isTestScope(it) }.each { + it.entryAttributes['test'] = 'true' + } } } + + defaultOutputDir = file('build') + downloadSources = true + downloadJavadoc = true } } + +boolean isLibrary(entry) { return entry.properties.kind.equals('lib') } +boolean isTestScope(entry) { return entry.entryAttributes.get('gradle_used_by_scope').equals('test'); } +boolean isModule(entry) { isLibrary(entry) && !isTestScope(entry); } +boolean isSource(entry) { return entry.properties.kind.equals('src'); } + + // add formatter and cleanup settings to Eclipse settings // see http://stackoverflow.com/a/27461890/873282 @@ -577,4 +599,4 @@ tasks.eclipse.doFirst { sp_cleanup.use_type_arguments=false '''. stripIndent()) } -} +} \ No newline at end of file