Integrate paper elements into Vaadin 10 project

Hi,

I’m trying to add the paper element “paper-rating” to my project. Therefore I installed bower and downloaded the paper-rating via the cmd

bower install --save mgibas/paper-rating

into the folder frontend/src/bower_components

I followed the instructions at https://vaadin.com/docs/v10/flow/web-components/integrating-a-web-component.html to create a java wrapper class.

When I try to run the application I get the error

NotSupportedError: Failed to execute ‘registerElement’ on ‘Document’: Registration failed for type ‘dom-module’. A type with that name is already registered.

What am I doing wrong here?

mgibas/paper-rating is based on Polymer 1: https://github.com/mgibas/paper-rating/blob/master/bower.json#L15

Polymer 1 was based on Shadow DOM v0 and other obsolete standards and is not supported by Vaadin 10. If there is a Polymer 2 version of the component, it will work

Thanks a lot Artur, the component iron-star-rating is working now.

I used bower to install the new component. Now I have a bower_components folder in my project which contains the same dependencies as the already included webjars e.g. iron-icons, iron-meta, iron-flex-layout.

I guess its bad practice to have them included twice. Whats the recommend way to include additional components?

Thanks,
Andreas

The problem with using both Bower and Bower based webjars is that you have a hard time knowing what version you are really using and that you do not have any version conflict problems. It’s typically best to stick to one of them. You can deploy publicly available Bower packages as webjars at webjars.org and then use them as Maven dependencies.