Reputation: 28811
I have a Ceylon project. I would like to distribute it in an uber jar that includes all dependencies, so that it can be executed with simple
java -jar myproject.jar
Is this possible in Ceylon?
Upvotes: 3
Views: 71
Reputation: 13690
The Ceylon Gradle Plugin can do it for you, just use the createJavaRuntime
task:
gradle createJava
Run the application with:
bash build/java-runtime/run.sh
or the equivalent in your OS.
If you copy the java-runtime
directory to a machine that has no Ceylon installed, only the JVM, it will work.
It's not a fat jar, but you can distribute this as a zip and get most of the same benefits.
Upvotes: 0
Reputation: 28811
The upcoming Ceylon 1.2.3 has the fat-jar
subcommand. See https://github.com/ceylon/ceylon/issues/5932 which tracks this feature. To use it now, you need to download a nightly build from http://ceylon-lang.org/download/ or build Ceylon yourself.
With Ceylon 1.2.3, assuming your module is called myproject
, you can do
ceylon-1.2.3/bin/ceylon fat-jar myproject
java -jar myproject-1.0.0.jar
This executes code in function run()
in file source/myproject/run.ceylon
.
The uberjar for a simple hello world program has currently 2.4 MiB.
Upvotes: 2