Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
7alpha3 JAR size blowup
In Vaadin 7alpha3 the Vaadin JAR file size has gone from 5.2M to 53M. This is a huge (10x) increase and causing me problems. There are other problems as well, such as the fact that it includes a version of Xerces which overrides the one I've been using (but that's easy to work around).
I realize this "all in one" approach is more convenient for certain people/situations, but in the process don't disregard the needs of people who need to deploy more intelligently.
In one of the announcements I thought I read there was going to be a "deployment" JAR that didn't have all the unnecessary GWT stuff, i.e., a 5.2M JAR equivalent to what we had before.
Where is this "deployment" JAR? It's not found anywhere under here.
Please provide a "deployment" JAR equivalent to what we had before. We can handle it :)
In the meantime, please provide instructions on how to take the new 53M JAR file and strip it back down. E.g., a list of zip delete patterns.
Archie Cobbs: In the meantime, please provide instructions on how to take the new 53M JAR file and strip it back down. E.g., a list of zip delete patterns
Answering my own question, this will create a traditional "deployment JAR" from the newly bloated Vaadin JAR:
$ zip -q -U vaadin.jar --out vaadin-stripped.jar 'com/vaadin*' 'VAADIN*' $ zip -q -d build/war/lib/vaadin-stripped.jar 'com/vaadin/external/com*' \ 'com/vaadin/external/mx4j*' 'com/vaadin/external/net*' 'com/vaadin/external/org*'
If you are building your own widgetset, you can also do this:
$ zip -q -d vaadin-stripped.jar \ 'VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet*'
You might also want to keep the JAR manifest (META-INF/MANIFEST.MF) although for most deployments it is not needed.
Note that JAR specifications say it must be the first entry in the ZIP.
If you really want to minimize the JAR size and don't need to recompile a widgetset with it or debug using it, you can even remove .java files. However, this should rarely be necessary.
Henri Sara: If you really want to minimize the JAR size and don't need to recompile a widgetset with it or debug using it, you can even remove .java files. However, this should rarely be necessary.
Thanks, didn't think of that.
Although I am generating a widgetset, this is done prior to stripping the JAR. So I've added '*.java' to the zip -d command.
I'm also stripping out all the VAADIN/* files because these have been "unpacked" into the WAR as recommended, and VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/* because I'm using my own compiled widgetset.
The resulting vaadin-stripped.jar is only 2MB!
From this experience I believe it makes sense for Vaadin to ship multiple JARs:
- vaadin-dev.jar - Used to compile Java classes and build widgetsets (same as the current vaadin.jar)
- vaadin-runtime.jar - Equivalent to the 2MB vaadin-stripped.jar described above
- vaadin-resources.jar - Contains all the VAADIN/* files (themes, icons, etc) not including default widgetset
- vaadin-widgetset.jar - Contains the compiled default widgetset
So a deployment (i.e. WAR file) would include vaadin-runtime.jar, vaadin-resources.jar and, if the standard widgetset were needed, vaadin-widgetset.jar. The latter would be included by default in "simplified" scenarios.