Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Custom layer definition does not pick up snapshots #23533

Closed
tjuchniewicz opened this issue Sep 30, 2020 · 6 comments
Closed

Custom layer definition does not pick up snapshots #23533

tjuchniewicz opened this issue Sep 30, 2020 · 6 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@tjuchniewicz
Copy link

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

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 30, 2020
@snicoll
Copy link
Member

snicoll commented Sep 30, 2020

@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

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Sep 30, 2020
@tjuchniewicz
Copy link
Author

tjuchniewicz commented Sep 30, 2020

@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.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Sep 30, 2020
@wilkinsona
Copy link
Member

wilkinsona commented Sep 30, 2020

@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.

@wilkinsona
Copy link
Member

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.

@wilkinsona wilkinsona added type: bug A general bug and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Sep 30, 2020
@wilkinsona wilkinsona added this to the 2.3.x milestone Sep 30, 2020
@wilkinsona wilkinsona self-assigned this Sep 30, 2020
@wilkinsona wilkinsona modified the milestones: 2.3.x, 2.3.5 Sep 30, 2020
@tjuchniewicz
Copy link
Author

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

@wilkinsona
Copy link
Member

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants