How to integrate a vaadin addon into a multi module maven project?

Hi!

I am developing a multi module application with vaadin and maven.

My module structure is like:

application-core.ui
application-core.service
extra-module.ui
extra-module.service

server-war

Where the server-war module contains widgetset.gwt.xml, styles.css and other static resources but no code.

Now I want to develop a Vaadin addon using some gwt widgets.
This addon should be integrated into the module structure.

So far I have added a new module:

my-vaadin-addon

which contains its own widgetset.gwt, styles.css, and images.

I have updated my maven dependencies so that the “server-war” project
knows the “my-vaadin-addon” module. When I look at the build path of
my eclipse project I can see that the “server-war” project directly
depends on the “my-vaadin-addon” project. But when I compile the
widgetset my addon is not included.

I have to manually put the my-vaadin-addon.jar into the build path
of “server-war”. Then the addon is recognized and included into the
compiled widgetset.

However this is far too complicated. Each time I have to:

  • build the addon manually
  • add the dependency to the jar file if required
  • rebuild the complete widgetset
  • restart the whole application

What is the correct way to achieve this ???

Another idea would be to put the code into the “application-core.ui” module,
which raises the following questions:

  • Can I separate the addon code over multiple modules?
  • Where do I put the css and resource, or do I just mix them up with the others?
  • How do I integrater further addons? (Just different packages ???)

I’m looking forward to your thoughts and insights.

regards Benjamin

Hi Benjamin,

I think this StackOverflow discussion might help you
http://stackoverflow.com/questions/21005268/how-can-i-compile-only-necessary-widgets-in-vaadin-7-with-maven

I’m currently refactoring one of my projects into the project structure proposed in the link above…

I finished my refactoring, you can find it from here:
https://github.com/johannest/similetimelineforvaadin/tree/refactoring/timeline/ChronoGrapher

My project now consist of three modules

  1. chronographer-addon - my chronographer widget

  2. chronographer-widgetset - project for making widgetset, out of all needed widgets (currently only one; the chronographer-addon), and packaging it into a jar file

  3. chronographer-demo - ui-project where no widgetset compilation is needed since it uses one allready compiled in the chronographer-widgetset project

The benefit is that multiple widgets could be used and there is no need to compile widgetset unless some widgets are changed.

Hi Johannes, thanks for the reply.

Just to get it clear: I can compile my widgetset and the modules it depends on
using maven. But the vaadin eclipse plugin can not handle the fact, that
my custom widgetset depends on a module with another custom widgetset.

I am looking forward to further thoughts on this topic.

Why would you need the vaadin eclipse plugin if you are able to compile widgetsets with Maven? I think you should not use the eclipse plugin in case like this…

I need to start the GWT development mode in order to debug my addon.
But when I start my application in GWT dev mode I get the following error:

Widgetset ‘com.sample.myWidgetset’ does not contain implementation for com.sample.SampleClass. Check its component connector’s @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.

I have to add the created jar + sources manually to my build path in order to fix this.
Seems not to be the right way for me.

Hi,

You can launch gwt development mode with maven target “vaadin:run” or with “vaadin:debug” (waits for remoted debugger to attach). So no need to use eclipse plugin for that either.

cheers,
matti

  1. VAADIN supports only 1 widgetset
  2. If your application needs more widgetsets, open the file YourProjectWidgetsetName.gwt.xml and add as below
  1. NOTE:
    i) org.vaadin.hene.popupbutton.widgetset.PopupbuttonWidgetset–> automatically falls in this above file if you use Eclipse widgetset compile option
    Reason: The widgetset is not available in ADDON JAR file. So this gets generated along with your project

    ii) de.akquinet.engineering.vaadin.javascriptplus.JavaScriptPlusForVaadin → Does not generate automatically. You need to manually enter the details
    Reason: The widgetset is already available in the ADDON JAR file. So you need to add it manually. Else you will not be able to find out the reason

  2. Please use this if logic if you need to add multiple custom widgetset in your project