WAR file size

I looking to make a web app that has a login page and has 1 button and a image of a LED that will flash. I started to do this in Vaadin and latest version is so big (32meg in Vaadin files ) it take a long time on start on Raspberry PI.

Is there a better way?

Then the button is pressed in software or triggers from the hardware, the hardware could take 1min or more before doing it stuff and flasher LED. 1 Flash good 2 Flash’s poor 3 Flash’s bad etc

​Is the a way to make it smaller?

That sounds crazy, but in your case, may be it’s better to make your .WAR even bigger. Try to recompress it with lower compression level. Despite of bigger size, decompression during deployment could be faster.

Does not help sill slow to deploy and start.

  1. Make sure Tomcat/Glassfish ( whatever you are running ) has enough RAM, make sure it is not started with -Xmx128m or something. If you are not using Jetty you might want to give it a try, its more light weight than Tomcat etc. The fact that the application takes very long to repsond when you press button would suggest you are constrained by some resource, probably RAM )
  2. To cut down on the size of the War
  3. Customize the widget-set and strip out all un-used wigets. If I’m not mistaken there is a wiki or tutorial about this )
  4. Avoid 3rd party libraries , use what the JDK and your application server provides ( where posible ).
  5. If your application server allows, try to install some of your dependencies as OSGI, though this can cause your startup time to increase a bit. Overall you will still use the same amount of space and ram , but deployment size of your app should shrink quite a bit.
  6. Check that you dont ship any libraries that already ship with your application server. ( mark them as provided in your pom ( or equivalent in Ivy )

  7. To improve startup
  8. Avoid CDI ( marginal , but on large applications CDI can take a few minutes to scan your application ).


By far the biggest library on our apps is vaadin-themes-7.x.jar at 7+MB this is nearly 1/4 of your application. Consider repackaging the themes jar ( not sure if this is quite as simple as it sounds though ).
And check that you don’t package large images in your own app …

Client is the bigest 18meg
​No large imiges…

 28K    wizards-for-vaadin-1.1.0.jar
 36K    vaadin-slf4j-jdk14-1.6.1.jar
 40K    streamhtmlparser-jsilver-0.0.10.vaadin1.jar
 64K    vaadin-cdi-1.0.2.jar
 72K    vaadin-lazyquerycontainer-
244K    vaadin-push-7.5.0.jar -- Only needed for push
520K    vaadin-sass-compiler-0.9.12.jar  -- Only needed compile time i think. --
756K    atmosphere-runtime-2.2.7.vaadin1.jar -- Only needed for push
776K    vaadin-charts-1.1.8.jar
908K    vaadin-client-compiled-7.5.5.jar
1.1M    custom-widgetset-3.7.2.jar ( Charts, Wizard , TokenField, PopupButton, ContextMenu )
2.2M    guava-16.0.1.vaadin1.jar
2.3M    vaadin-shared-7.5.5.jar
3.2M    vaadin-server-7.5.5.jar
7.2M    vaadin-themes-7.5.5.jar

Client should weigh in at less than 1MB, not 18MB , obvoiusly there are other dependencies too but none of them were very big…

Remove vaadin-client-7.5.5.jar from your dependency , you only need vaadin-client-compiled-7.5.5.jar

Note, that also vaadin-client-compiled is not needed into war, if you have a custom widgetset in your application. vaadin-client is only needed in certain cases when you have project specific widgets, and then it should be declared as “provided” as it is only needed for GWT compilation, not at runtime in the application server.

Using CDN to serve your theme and widgetset will further bring down the size of your war file as well.

I recently built a very trimmed down Vaadin setups for some IoT projects. Those also have embedded web server and are thus jar packaged, but you might get some ideas if you want to trim down the size of war.

The main reason why modern app servers are bit slow to start with large war files is that they scan for servlet 3 annotations (servlets, filters etc.). This can in some cases be optimized a lot by using web.xml file with metadata-complete=true, after only the actual application sources are scanned.


What is the best way to remove them, I am using Eclipse


If you are using Maven (which I highly favor over IVY or manually drag and dropping your dependencies), have a look at this example (that I forgot to link into previous post):

For vaadin-client (if you need to have it) use provided, with other obsolete stuff just remove the depenencies or exclude them if they are transitive (like e.g. vaadin-sass-compiler and guava in the above example).


Using IVY

I will have a look at Maven now ​

I tryed and failed with Maven…