Implementing Java API for <vaadin-item>

Hi all,

I want to use the the vaadin-item in my application and maybe I have a bit stupid questions. I did that the standard way according to the documentation. Since it’s already used in the ListBox for example (but the class is not public), I have some complains in the logs that there are 2 versions of the webcomponent in my project. I don’t want to keep track of the vaadin-item version every time I update the Vaadin version, because I think it’s maybe quite annoying to do so.

So the questions are:

  • Is it okay if I just use the @Tag annotation to define the html tag and skip the npm/bower imports?
  • Is that risky and can I end up not having the webcomponent imported in my project?
  • What is the recommended way of proceeding in this kind of situations?

Thanks in advance

One simple solution (workaround) is to annotate your component with @Uses(Listbox.class) then if you are using your component it will get the vaadin-list-box and its dependencies.

As you already use the listbox, it changes nothing. And if you remove the Listbox usage in your project, then it will still work.

I’m not sure if there is a recommended way of managing this with the NpmPackage annotation (except for adding this version ^2.2.0 which should work if you stay in the same major vaadin version I think).

You can also use pnpm that have a better dependency management, it can help.

Jean-Christophe Gueriaud:
One simple solution (workaround) is to annotate your component with @Uses(Listbox.class) then if you are using your component it will get the vaadin-list-box and its dependencies.

As you already use the listbox, it changes nothing. And if you remove the Listbox usage in your project, then it will still work.

I’m not sure if there is a recommended way of managing this with the NpmPackage annotation (except for adding this version ^2.2.0 which should work if you stay in the same major vaadin version I think).

You can also use pnpm that have a better dependency management, it can help.

I think I will go for the first proposal, sounds to me more secure than the others and also more simple.
Thanks a lot for your reply!