Vaadin Maven - Custom GWT Procedure

Good day, everyone!

I would like to ask for directions or a tutorial on how to properly create and integrate a custom gwt widget.
What is the proper way in creating of creating a custom widget?
Should I create a separate project using the GWT sdk
OR
should I just use Vaadin’s way of creating a custom component?

I tried following Vaadin’s tutorial on simple components, problem is the pom configuration, I can’t seem to properly configure it to integrate the creation of gwt.
https://vaadin.com/wiki/-/wiki/Main/Creating%20a%20simple%20component

I also tried to follow the integration of an existing gwt component from:
https://vaadin.com/wiki/-/wiki/Main/Integrating%20an%20existing%20GWT%20widget
Where you have to download a jar from gwt g-flot and put it in the projects web-inf folder.
And the problem is, in my Maven setup, there is no web-inf folder, since the libraries are acquired through the pom and will be automatically packaged with the project instead of putting it manually.

Any advice? Thanks!

Hi,

I recommend trying this GWT widget archetype: https://github.com/viritin/archetype-vaadin-gwt-addon - It’s self-contained and quite easy to develop with.

-Olli

Okay, so what I will do is add this as a separate module in a multi-module maven project? And then just add it as a dependency for my Vaadin Project?
Is that right?

Thanks!

You might want to create a separate projects eventually (one for demo / development that’s not included in release and one for the widget only), but yeah.

-Olli

Okay, got it! Thanks!

Is it possible to attach an external gwt plugin in the maven dependency to the project??
I’m trying to add this dependency:
https://mvnrepository.com/artifact/com.allen-sauer.gwt.dnd/gwt-dnd

But an error occurs:

No source code is available for type com.allen-sauer.gwt.dnd did you forget to inherit a required module?

Is it possible to do so??

That’s a GWT error. Did you include the included module in your .gwt.xml file? See https://vaadin.com/wiki/-/wiki/Main/Integrating+an+existing+GWT+widget for some extra information as well.

-Olli

Yep
I did try to include it in the .gwt.xml file.
The error doesn’t occur on the project module of the addon itself, it occurs in the project where I add the addon as a dependency too.

EDIT:
There’s an error when I’m trying to compile the widgetset too in the addon, its this: GWT Module com.allen-sauer.gwt.dnd not found in project sources or resources.
I have the dependency in my pom.xml:

<!-- https://mvnrepository.com/artifact/com.allen-sauer.gwt.dnd/gwt-dnd -->
<dependency>
    <groupId>com.allen-sauer.gwt.dnd</groupId>
    <artifactId>gwt-dnd</artifactId>
    <version>3.3.4</version>
</dependency>

And added it to my Widgetsets.gwt.xml by: <inherits name="com.allen-sauer.gwt.dnd" />

One idea: try adding another copy of the dependency with

<classifier>sources</classifier> as GWT compilation requires also the source code of the client side modules to be available, and not all add-ons include it in the main JAR.

Okay, so it should be like this?

<dependency>
    <groupId>com.allen-sauer.gwt.dnd</groupId>
    <artifactId>gwt-dnd</artifactId>
    <version>3.3.4</version>
    <classifier>sources</classifier>
</dependency>
[/code][b]
EDIT 2 : - changed error
[/b]
Just tried the above, still doesn't work. 
[code]
[INFO]
    Loading inherited module 'com.allen-sauer.gwt.dnd'
[INFO]
       [ERROR]
 Invalid module name: 'com.allen-sauer.gwt.dnd'
[/code]

Widgetset is:[code]
<module>
<!-- WS Compiler: manually edited -->
<inherits name="com.vaadin.DefaultWidgetSet" />
<inherits name="com.allen-sauer.gwt.dnd" />
<set-configuration-property name="devModeRedirectEnabled" value="true" />
<source path="client/"></source>
</module>

And on the pom of the project, its: <dependency> <groupId>com.allen-sauer.gwt.dnd</groupId> <artifactId>gwt-dnd</artifactId> <version>3.3.4</version> </dependency> <dependency> <groupId>com.allen-sauer.gwt.dnd</groupId> <artifactId>gwt-dnd</artifactId> <version>3.3.4</version> <classifier>sources</classifier> </dependency> I placed two dependencies, one with the classifier, still a no go.

At least according to
https://github.com/fredsa/gwt-dnd/wiki/GettingStarted
the module to inherit should use underscore instead of dash in the package path part:

<inherits name='com.allen_sauer.gwt.dnd.gwt-dnd'/>

Yup. This fixes it.

Thanks!