Ceylon Fat JARs
Ceylon Fat JARs
With Ceylon 1.2.3's impending release, we have a look at one of its much-anticipated new features: Fat JARs. Read on to find out more.
Join the DZone community and get the full member experience.Join For Free
Get the Edge with a Professional Java IDE. 30-day free trial.
Ceylon 1.2.3 is looming closer, and so we should start talking about some of the new features that it will contain. One of those new features is the new
ceylon fat-jar command.
ceylon fat-jar my.module/1 lets you generate a jar which contains the
my.module/1 module and every required dependency. Once you have that jar, you can execute it with
java -jar my.module-1.jar and it will execute the module.
Naturally, you can customise the function or class to execute with the
--run option, but the default is the
run method in your module (
my.module::run in our case).
The modules are executed in a "flat classpath" mode, without JBoss Modules or any sort of module isolation, and with the metamodel already set up statically when the fat jar was created, so it's a little bit different to the older alternative of running Ceylon modules using the Main API and
ceylon classpath tool, which did not deal with packing all the dependencies. It is also different to the
ceylon run --flat-classpath in that it does not require a module repository at run-time, since
ceylon fat-jar packs it all together.
Try it out, it's pretty useful to distribute Ceylon programs and run them in places without having to install the Ceylon distribution.
Published at DZone with permission of Stephane Epardaud , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.