Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Detect bootJar task (Spring Boot fat JAR) and enable jar task to use the thin JAR #2178

Merged
merged 13 commits into from
Dec 6, 2019

Conversation

chanseokoh
Copy link
Member

@chanseokoh chanseokoh commented Nov 26, 2019

Implements #1852 (comment) for Gradle. That is, this automatically enables #1851 (comment) and makes use of the thin JAR by the jar task.

Closes #1851.

@chanseokoh chanseokoh requested a review from a team December 4, 2019 15:48
Copy link
Member

@loosebazooka loosebazooka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good. Would it make sense to start a document describing how jib handles different frameworks? <-- not necessary but could be nice to point specific framework users to?

@chanseokoh
Copy link
Member Author

Would it make sense to start a document describing how jib handles different frameworks? <-- not necessary but could be nice to point specific framework users to?

I need to keep researching on it. Work in progress.

@ewirch
Copy link

ewirch commented Feb 10, 2020

The commit message says: "Detect bootJar task and enable jar task". But it does more. It also forces the classifier to 'original'.

a692b8b#diff-aef8bf567c91df6622aa0ea29ed0c682R192

Why would you do so? This broke our build. I can't set the classifier manually any more. Except: not applying jib.

@chanseokoh
Copy link
Member Author

Hi @ewirch,

When you apply the Spring Boot plugin, it will automatically disable the jar task. But sounds like you manually enabled it and set the classifier for either the jar task or the bootJar task. Could you share your build.gradle (or just the part related to configuring both the jar and bootJar tasks)?

@ewirch
Copy link

ewirch commented Feb 10, 2020

Sure thing. The important part is here:

jar {
    enabled = true
}

bootJar {
    archiveClassifier = 'boot'
}

This part is reused in multiple sub-projects of a multi project build. This will give use two artifacts per sub-project:

  • <name>.jar
  • <name>-boot.jar

We use both in different deployment scenarios. After updating jib to 2.0.0 we end up with:

  • <name>-original.jar
  • <name>-boot.jar

without a option to get the original naming back. Sure, we could adjust our build scripts to use <name>-original.jar instead. But it feels incorrect for a Docker image building plugin to interfere in such a way with the build configuration.

@chanseokoh
Copy link
Member Author

chanseokoh commented Feb 10, 2020

@ewirch that makes sense. I think we can fix this easily. How about this?

Basically, if the classifier or archiveClassifier of bootJar is set, then make Jib not set the classifier of the jar task. The only reason we set the classifier was to avoid bootJar and jar writing each JAR to the same location (overwriting each other).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

containerizingMode = 'packaged' does not work with Spring Boot in Gradle
4 participants