Cannot nest resources produces error

buildship
eclipse

(Clint D) #1

Cannot nest ‘submodule/src/main/java/resources’ inside ‘submodule/src/main/java’. To enable the nesting exclude ‘resources/’ from ‘submodule/src/main/java’

I have legacy projects that have the resources folder under the source folder (as shown above). When I use a multi-module build I can’t bring the project into eclipse

given rootFolder/build.gradle
subprojects {
apply plugin: ‘java’

	sourceSets {
		main {
			java {
				srcDirs = ['src/main/java']
				exclude 'resources/'
			}
			resources {
				srcDirs = ['src/main/java/resources']
			}
		}
	}
}

I cannot figure out how to have sub projects ‘exclude’ the resources folder. I’ve tried all the combinations I can think of - I expect there’s some way to make it work but I cannot seem to get it right. I’ve tried:

srcDir 'src/main/java'
exclude 'resources/**'

srcDir 'src/main/java'
exclude 'resources/'

srcDirs = ['src/main/java']
exclude 'resources/**'

srcDirs = ['src/main/java']
exclude 'resources/'

etc. - boy if someone could show me how to do this (or confirm it’s a bug?) I would be most appreciative. I tried to search the forum for this but the only posts i found were from > 1 year ago


(Stefan Oehme) #2

This works just fine for me with Buildship 2.0 and Gradle 3.3.


(Clint D) #3

shoot i forgot to mention gradle 2.14.1 - and i forgot to test 3.3. :frowning: my bad.


(Clint D) #4

I’m happy to report that you’re correct - it worked fine in 3.3. I don’t expect there’s any support for 2.14?


(Stefan Oehme) #5

Unfortunately not. Support for these customizations was added in 3.0