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

Do not override jar task's classifier if bootJar task does not interfere in Gradle #2278

Closed
chanseokoh opened this issue Feb 10, 2020 · 3 comments · Fixed by #2284
Closed
Assignees
Milestone

Comments

@chanseokoh
Copy link
Member

chanseokoh commented Feb 10, 2020

In #2178, we overrode the archiveClassifier (classifier is deprecated) of the jar task, because by default both the jar and bootJar tasks write their respective JAR to the same location (build/<name>.jar). However, if bootJar is configured to write its fat JAR to a different location, there's no need to rename the original JAR generated by the jar task.

@ewirch

@chanseokoh chanseokoh added this to the v2.1.0 milestone Feb 10, 2020
@chanseokoh chanseokoh self-assigned this Feb 10, 2020
@ewirch
Copy link

ewirch commented Feb 10, 2020

Basically, if the classifier or archiveClassifier of bootJar is set, then make Jib not set the classifier of the jar task.

That would do the trick.

But, wouldn't it be cleaner to create a new 'jar' task, exclusively for jib? Then you wouldn't need to mess with the default 'jar' task.

@chanseokoh
Copy link
Member Author

chanseokoh commented Feb 10, 2020

create a new 'jar' task, exclusively for jib

Looks like it's not easy to clone the jar task that guarantees to create the exact same jar file as the jar task will produce.

That said, I have refined the logic to be more conservative like this:

  • If both bootJar and jar are enabled and their jar locations conflict, throw an error. This is really like a misconfiguration that the user needs to address.
  • Set the classifier of jar to original only when all the followings are true.
    1. jar is disabled.
    2. bootJar is enabled.
    3. Their jar locations conflict.

@chanseokoh
Copy link
Member Author

@ewirch we've release Jib 2.1.0 with this change. You may want to take a spin.

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