I use Spring Boot 2.3.4 with custom layers.xml to configure jar layers.

Example provided here: https://docs.spring.io/spring-boot/docs/2.3.4.RELEASE/maven-plugin/reference/html/#repackage-layers-configuration does not pick up snapshots. Is <include>*:*:*SNAPSHOT</include> pattern correct? When I use default settings (no custom layer.xml) snapshots are handled correctly.

See example project to reproduce issue: https://github.com/tjuchniewicz/spring-boot-custom-layer-with-snapshots

Comment From: snicoll

@tjuchniewicz thanks for the report and the sample but I don't understand your sample project. I've ran it and then extracting the layers without any modification and here is a partial output:

total 0
drwxr-xr-x  4 snicoll  staff   128B Sep 30 10:38 application
drwxr-xr-x  3 snicoll  staff    96B Sep 30 10:38 dependencies
drwxr-xr-x  3 snicoll  staff    96B Sep 30 10:38 snapshot-dependencies
drwxr-xr-x  3 snicoll  staff    96B Sep 30 10:38 spring-boot-loader
snapshot-dependencies
└── BOOT-INF
    └── lib
        └── spring-boot-autoconfigure-2.3.5.BUILD-SNAPSHOT.jar

2 directories, 1 file

Comment From: tjuchniewicz

@snicoll That's really interesting...inside jar I see in layers.idx

- "dependencies":
  - "BOOT-INF/lib/"
- "spring-boot-loader":
  - "org/"
- "snapshot-dependencies":
- "application":
  - "BOOT-INF/classes/"
  - "BOOT-INF/classpath.idx"
  - "BOOT-INF/layers.idx"
  - "META-INF/" 

after I execute java -Djarmode=layertools -jar target/demo-0.0.1-SNAPSHOT.jar extract I see empty snapshot-dependencies dir.

Comment From: wilkinsona

@tjuchniewicz Thanks for reporting this. It's rather fascinating as Stephane cannot reproduce the problem but I can, despite us both being on macOS, using the same version of Maven, and very similar versions of Java. I'll investigate and see if I can figure out why it doesn't work for me.

Comment From: wilkinsona

The bug is due to Maven's handling of snapshot versions and the distinction between a base version and a version in certain circumstances. The latter replaces SNAPSHOT with a timestamp which then doesn't match the pattern.

Stephane wasn't affected as he'd built and installed Spring Boot into his local Maven repository so he had artifacts named *-BUILD-SNAPSHOT rather then the *-BUILD-<timestamp> that is resolved from repo.spring.io.

Our build didn't catch the problem either as it's in the process of building the artifacts that are being tested so it doesn't resolve them from repo.spring.io either.

Comment From: tjuchniewicz

Works fine using spring-boot-maven-plugin 2.3.5.BUILD-SNAPSHOT. Thank you @wilkinsona

Comment From: wilkinsona

Excellent. Thanks very much for trying a snapshot, @tjuchniewicz.