Preventing a subproject from producing a jar in a multi-project build?


(hmartin) #1

Hi. I’ve been banging my head against the wall for a few days. I posted another question a few days ago on a related topic, but only got one response, and it didn’t solve my problem, so I’m trying again. My project is a multi-project build. We’re using Spring Boot, and the build files use the spring-boot plugin, which produces a fat jar. Because of some class loading issues when the fat jar contains nested jar files, I want the compiled classes/resources from my sub-projects to be included in the fat jar directly rather than packaged inside jar files. I’ve gotten as far as managing to include the compiled classes/resources as files, but the fat jar still contains the jar files produced by the sub-projects. So I’m essentially getting the same classes/resources included twice, which I’d like to avoid. I’ve followed the recipe for the spring-boot plugin from this page, but it doesn’t seem to work: http://docs.spring.io/spring-boot/docs/current/reference/html/build-tool-plugins-gradle-plugin.html

If I could just figure out how to prevent my sub-projects from producing a jar file, I think I’d be home free. I’ve tried to declare an empty jar task, but that doesn’t seem to make any difference. I’m sure there must be an easy way of doing this!


#2

Something like:

subprojects {

jar.enabled = false }