When updating to spring-boot-gradle-plugin 1.4.0.RELEASE lib project dependendency isn't in classpath

plugins
not-a-bug

(binarylegit) #1

Gradle Version: 2.13, 3.0
Operating System: Windows 10

I have a multi-project gradle project. All of the subprojects include the spring-boot-gradle-plugin and “apply plugin: ‘spring-boot’”. I have two sub-projects that depend on other sub-projects so say project B has “compile project(’:A’)” when upgrading from spring-boot-gradle-plugin version 1.3.1.RELEASE to version 1.4.0.RELEASE I started getting compilation errors in project B stating ‘Cannot find symbol’ of a class that should be available in project A which it depends on. What changed that is causing the compilation to fail?


(binarylegit) #2

After doing some more research it appears this is not a gradle issue at all; it relates to the spring-boot-gradle-plugin and specifically to how it structures the jar files differently between version 1.3.1.RELEASE and 1.4.0.RELEASE.

I have two projects A and B. They both need to be executable jars, however project B relies on some classes in project A. In spring boot version 1.3.1.RELEASE this is fine because all of the programs classes are kept in the root of the jar file. In version 1.4.0.RELEASE of the spring-boot-gradle-plugin, however, all of the classes are kept in a BOOT-INF folder inside of the jar file which hides those classes from anything that would add that jar to it’s classpath, causing the compilation errors stated above.

So it appears that in spring-boot-gradle-plugin 1.4.0.RELEASE you lose the (perhaps unintended) functionality of being able to use a spring-boot generated executable jar as both an executable jar and a library jar.