@@ -42,14 +42,28 @@ if (gradle.startParameter.taskNames.contains("eclipse")) {
4242 classpath {
4343 defaultOutputDir = file(' build/eclipse' )
4444
45+ downloadSources = true
46+ downloadJavadoc = false
47+
48+ plusConfigurations + = allprojects. findAll{ prj ->
49+ return prj. plugins. hasPlugin(JavaPlugin )
50+ }. collectMany {
51+ return [ it. configurations. compileClasspath, it. configurations. testCompileClasspath ]
52+ }
53+
4554 file {
46- beforeMerged { classpath ->
55+ whenMerged { classpath ->
4756 classpath. entries. removeAll {
48- it. kind == " src"
57+ return it. kind == " src" || (it. kind == " lib" && it. getPath() ==~ / (.+)lucene-.*\. jar/ )
58+ }
59+
60+ // I'm not sure what these attributes are supposed to do. Keeping the previous version of having no-attributes.
61+ classpath. entries. each {
62+ if (it. kind == " lib" ) {
63+ it. getEntryAttributes(). clear()
64+ }
4965 }
50- }
5166
52- whenMerged { classpath ->
5367 def projects = allprojects. findAll { prj ->
5468 return prj. plugins. hasPlugin(JavaPlugin )
5569 }
@@ -62,31 +76,20 @@ if (gradle.startParameter.taskNames.contains("eclipse")) {
6276 ' tools'
6377 ] as Set
6478 Set<String > sources = []
65- Set<File > jars = []
6679 projects. each { prj ->
6780 prj. sourceSets. each { sourceSet ->
6881 if (sourceSetNames. contains(sourceSet. name)) {
6982 sources + = sourceSet. java. srcDirs. findAll { dir -> dir. exists() }. collect { dir -> relativize(dir) }
7083 sources + = sourceSet. resources. srcDirs. findAll { dir -> dir. exists() }. collect { dir -> relativize(dir) }
7184 }
7285 }
73-
74- // This is hacky - we take the resolved compile classpath and just
75- // include JAR files from there. We should probably make it smarter
76- // by looking at real dependencies. But then: this Eclipse configuration
77- // doesn't really separate sources anyway so why bother.
78- jars + = prj. configurations. compileClasspath. resolve()
79- jars + = prj. configurations. testCompileClasspath. resolve()
8086 }
8187
8288 classpath. entries + = sources. sort(). collect { name ->
8389 def sourceFolder = new SourceFolder (name, " build/eclipse/" + name)
8490 sourceFolder. setExcludes([" module-info.java" ])
8591 return sourceFolder
8692 }
87- classpath. entries + = jars. unique(). findAll { location -> location. isFile() && ! (location. name ==~ / lucene-.*\. jar/ ) }. collect { location ->
88- new LibEntry (location. toString())
89- }
9093 }
9194 }
9295 }
@@ -132,23 +135,3 @@ if (gradle.startParameter.taskNames.contains("eclipse")) {
132135 }
133136}
134137
135- public class LibEntry implements ClasspathEntry {
136- private String path;
137-
138- LibEntry (String path ) {
139- this . path = path;
140- }
141-
142- @Override
143- String getKind () {
144- return " lib"
145- }
146-
147- @Override
148- void appendNode (Node node ) {
149- node. appendNode(" classpathentry" , Map . of(
150- " kind" , " lib" ,
151- " path" , path
152- ))
153- }
154- }
0 commit comments