FHIR Chat · Packaging for utility jars · ibm

Stream: ibm

Topic: Packaging for utility jars


view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:15):

For 4.0.1 we created the following epic for packaging our various utilities with the fhir server distribution: https://github.com/IBM/FHIR/issues/575

view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:16):

now we are getting into the meat of it and we're wondering how to package them

view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:17):

For fhir-persistence-schema, Paul created a shaded jar that has a final name which omits the version:
pasted image

view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:18):

conversely, I used the shade plugin's default and ended up replacing the versioned jar with the single executable jar:
pasted image

view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:19):

do we want to generate both shaded and non-shaded jars for these 2 module? do we want the version included in the final executable jar's name (the jar that gets packaged with the distribution)?

view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:20):

for fhir-validator, it gets even more interesting, because we probably DO want both the "normal" and "uber-jar" variants for that one

view this post on Zulip Paul Bastide (Jan 13 2020 at 21:24):

rough size differences are 72K to 16M for fhir-persistence-schema

view this post on Zulip Paul Bastide (Jan 13 2020 at 21:25):

the good news in the case of persistence-schema it's bound closely to the model.

view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:31):

I think my slight preference is to generate ONLY the uber jar for persistence-schema and swagger-generator, since I don't know of any re-use scenarios for those outside of just executing them

view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:32):

but i couldn't really figure out how to make the shade plugin do that (in my case it just moved the 'normal' jar to original-*.jar

view this post on Zulip Paul Bastide (Jan 13 2020 at 21:32):

I'm +1 on that plan

view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:32):

but i think ONLY the shaded jar gets 'attached' as the output

view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:32):

so thats the only one that would end up in the maven repo

view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:32):

i think

view this post on Zulip Paul Bastide (Jan 13 2020 at 21:33):

they can all end up there

view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:33):

Do you have opinion on the second part; should the packaged executable jar have a version postfix or no?

view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:45):

Ugh, the fhir-swagger-generator actually pulls in all of fhir-examples too, because I updated it to include examples in the generated api definitions

view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:45):

so that one comes in around 65 MB

view this post on Zulip Lee Surprenant (Jan 13 2020 at 21:46):

which means the combined weight of these three utilities will increase our distribution by like 100 MB

view this post on Zulip Paul Bastide (Jan 13 2020 at 22:00):

@Lee Surprenant we can add an exclusion on that to the shadeplugin

view this post on Zulip Paul Bastide (Jan 13 2020 at 22:00):

it'll cut the size down

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:01):

the problem is its actually used during generation

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:01):

its a legit dependency of the plugin

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:01):

we don't use ALL of the examples

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:01):

but we do use some subset of them

view this post on Zulip Paul Bastide (Jan 13 2020 at 22:01):

hum... I think we can use a transformer and strip it out

view this post on Zulip Paul Bastide (Jan 13 2020 at 22:01):

tell me what you want, and I think I can remove the others

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:02):

at some future time, i was thinking of letting the user specify which examples they want

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:02):

e.g. spec examples, minimal examples, or mock examples

view this post on Zulip Paul Bastide (Jan 13 2020 at 22:03):

Excluding Resources with the DontIncludeResourceTransformer

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:03):

we NEVER want the complete-absent ones though

view this post on Zulip Paul Bastide (Jan 13 2020 at 22:03):

https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#IncludeResourceTransformer

view this post on Zulip Paul Bastide (Jan 13 2020 at 22:03):

we can use that

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:03):

cool

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:04):

today, the only ones we use are the ones at /json/ibm/complete-mock

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:04):

and of those, only the ones with a postfix of -1

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:04):

e.g. /json/ibm/complete-mock/Patient-1.json

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:05):

btw i asked google about the version vs non-version jar and read through the answers at https://stackoverflow.com/questions/16482102/when-should-a-jar-file-name-have-a-version-number-in-it-what-are-the-pros-and-c

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:05):

so now i'm thinking of including the versions (which is also the maven and shade default)

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:08):

resulting structure will be
pasted image

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:09):

although I always wondered if we could flatten it a bit more

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:10):

@John Timm any idea why we include the fhir and server directories in this distribution zip?

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:10):

seems like the two directories under server could just be added directly under fhir-server-dist

view this post on Zulip Lee Surprenant (Jan 13 2020 at 22:15):

or perhaps just replacing fhir/server with some other name like installFiles would help make it clearer that these are artifacts that are used by the install scripts to install the server within a new directory

view this post on Zulip John Timm (Jan 14 2020 at 14:57):

@Lee Surprenant I'm not sure why it is nested like that. That layout hasn't changed in quite a while.

view this post on Zulip Lee Surprenant (Jan 15 2020 at 13:20):

after a few different iterations, we ended up creating a "shaded" version of both fhir-swagger-generator and fhir-persistence-schema. to make their purpose more clear, I attached a classifier of "cli" to the all-in-one executable flavor of these jars. I also updated their READMEs. The PR was https://github.com/IBM/FHIR/pull/587


Last updated: Apr 12 2022 at 19:14 UTC