https://kotlinlang.org logo
#http4k
Title
# http4k
s

Shingi Chanakira

02/19/2021, 3:46 PM
I created a basic Hello World app using the http4k generator. I can do a gradle clean build and a jar file is generated. When I try to run the jar file, I get an error that the jar is missing a manifest file. I added a jar tag with a manifest attribute but now I'm getting class loading errors. Anyone know what I'm missing?
d

dave

02/19/2021, 4:38 PM
are you using shadowjar? the problem will be the mime-type file I assume?
(if you're not using shadowjar you problaby should
s

Shingi Chanakira

02/19/2021, 4:43 PM
Yes, I'm using the shadow jar. What should I check in the mime-type file?
d

dave

02/19/2021, 4:48 PM
if you're using shadow, you need to merge the service files
which is pretty much putting this in your gradle file:
Copy code
shadowJar {
  mergeServiceFiles()
}
I'm actually not sure if the toolbox is generating the correct output for the shadowJar option.
s

Shingi Chanakira

02/19/2021, 4:54 PM
Thanks, let me check it
d

dave

02/19/2021, 5:26 PM
(I've located the bug in the toolbox which you hit by the way - when you selected the shadowJar option it didn't actually select it - fixing it now! 🙂 )
s

Shingi Chanakira

02/19/2021, 5:56 PM
Cool, thanks
b

Ben Brodie

02/19/2021, 6:18 PM
Another option is to use
gradle install
and then you’ll have a script you can run at
build/install/myapp/bin/myapp
I believe you get this for free with the
application
plugin
d

dave

02/19/2021, 6:28 PM
yeah - the shadowjar is a convienient way of bundling stuff, but it really depends on how the service is going to be started in the target environment - if it's going to be
java -jar XYZ
or a docker container where you can call a script.
12 Views