On 15/12/2010, at 8:16 PM, richardm wrote: > > I have several SourceSets (in addition to main), however the additional > SourceSets only get compiled if I add a build dependancy e.g. > build.dependsOn xmlClasses (for a SourceSet called xml). > > I thought adding the SourceSet while using the Java plugin meant it would > get built in the same way as main? Is adding a build dependancy on > sourceSetClasses the correct way to build the other SourceSets?
A source set is built as it is needed, for example, to be included in a jar or to run tests. A source set on it's own isn't generally very useful (or, at least, that's the assumption). And so, it is not always built. I'm curious, what do you use these source sets for, where you want to build only the classes? Based on that, we can come up with a good way for these to be included. > > Also, if using the Java plugin, do you have to have a SourceSet called main? You can use the 'java-base' plugin. It adds all the infrastructure for source sets, but does not define any. So, you don't get a 'main' or a 'test' source set. However, you do miss out on a few other things, which you may or may not care about: * Documentation * Less stable than the 'java' plugin * The 'jar', 'test' and 'javadoc' tasks * The 'compile', 'runtime', 'testRuntime', 'testCompile' configurations -- Adam Murdoch Gradle Developer http://www.gradle.org CTO, Gradle Inc. - Gradle Training, Support, Consulting http://www.gradle.biz
