How to use an add-on inside another add-on

Hello,

I have written an add-on (name ‘a’), which uses another add-on (name ‘b’). Everything works quite fine inside my add-on-project (I placed add-on ‘b’ in a lib-folder and put it to the classpath). But when I export my plugin ‘a’ via eclipse (File → export → Vaadin → Vaadin Add-on Package incl. lib-folder) and use it somewhere else (name ‘c’)I always get the error message during compilation of the widgetset, that the widgetset compiler is not able to find ‘widgetset-b.gwt.xml’. It only worked when I placed add-on ‘b’ explicit on the classpath of project ‘c’. But that is a little bit stupid. I already placed add-on ‘b’ in my add-on ‘a’ to be sure, that everything is in one.
Is it not possible to do something like that? Do I have to configure something else?

Hi,

Sounds like you should throw in a build system that supports transitive dependencies. I’d re-create the add-on using Maven archetype called “vaadin-archetype-widget”, add dependency to the other add-on there and package. Things should work well then.

cheers,
matti

Thanks, I thought it has something to do with the structure of the generated jar archive of add-on ‘a’ or something like that and the dealing of the gwt compiler with the jar. Maybe the gwt compiler is not able to handle add-ons inside add-ons.

All source files, not just binaries, must be available during widgetset compilation. Jars inside jars don’t work neither for JVM or GWT compiler. All this soon becomes horrible unless you proper use dependency management system. Even if you could make your build work, it would still be hard for users trying to aid from your generated add-on.

If your pom.xml is properly configured in your add-on, then end users just need to add the dependency to your add-on, they’ll automatically received the other add-on as transient dependency, and then just need to do clean build to start using it.

cheers,
matti

You might want to look at e.g. FilteringTable add-on (found at
http://vaadin.com/directory/#addon/filteringtable
) which has a pom.xml (in WebContent/META-INF/maven/org.vaadin.addons/filteringtable) that has a dependency to the PopupButton add-on, so you should be able to use it directly in a Maven project and the dependency will be fetched automatically.

-tepi