2

I have the following maven project setup. I have a parent module with a number of child modules one which is a spring boot application. I am trying to build a "layered" spring boot application jar for that child module but unable to.

The child module that is a spring boot application has a dependency management section that includes spring-boot-dependencies as described here : https://docs.spring.io/spring-boot/docs/2.1.11.BUILD-SNAPSHOT/reference/html/using-boot-build-systems.html. The "build" element of this child module declares the spring boot maven plugin as described here : https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/html/#repackage-layered-jars-tools .

When the "layers" are disabled , i get a "fat" jar and a folder structure with files i would expect. But when "layers" are enabled, i get a fat jar that is corrupt. The corrupt jar has the same folder structure as the non-layered jar but in addition has an empty folder called "BOOT-INF(1)" which winzip says is a result of an invalid file name. The BOOT-INF folder itself in the layered jar looks identical to the non-layered jar(except for new classpath.idx and layers.idx files) but has no layers whatsoever. Interestingly enough the classpath.idx and layers.idx files under BOOT-INF folder have the correct entries when layering is turned on. I get identical results when i provide my own custom layers.xml file except that layers.idx matches my layers in the custom layers.xml file.

I am unable to post actual code because of company restrictions.Has anyone come across a similar problem?I tried the -X maven debug option but i couldn't spot what was going wrong during the "repackaging" phase. I am using spring boot 2.3.2.

prem
  • 21
  • 1

0 Answers0