4

I have a working project with Dropwizard and Vaadin7. I need to use Vaadin8 with the existing environment without removing vaadin7 code. Can I run my project by using Vaadin7 and Vaadin8 both version? As I am new to the Vaadin can anybody help me with some direction about how to solve this issue?

<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-themes</artifactId>
    <version>7.5.10</version>
</dependency>
<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-client-compiled</artifactId>
    <version>7.5.10</version>
</dependency>
<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-client</artifactId>
    <version>7.5.10</version>
</dependency>

This is my current vaadin configuration

Robert
  • 1,710
  • 2
  • 18
  • 35
Swagat
  • 709
  • 3
  • 9
  • 27

2 Answers2

6

You can't use two versions of the same dependency in Maven, it will take the first one.

As far as you are not using COMMUNITY ADD-ONS in your code it won't be a problem to upgrade the version to 8.

I leave you a good guide to learn how to upgrade the versions: Guide to upgrade vaadin

Paplusc
  • 1,080
  • 1
  • 12
  • 24
3

As already noted, you can't have two versions specified of the same dependency in maven, but in this particular case, did you consider to use compatibility packages with Vaadin 8 Migrating to Vaadin 8? Then you would be able to access the classes needed from the Vaadin 7 framework using *.v7.* imports. Like noted in the link above:

The only change to classes in the compatibility packages is the change in their classpath. All compatibility classes can be found under com.vaadin.v7.*. For example the compatibility TextField is available through the import import com.vaadin.v7.ui.TextField, given that the project dependencies have been set up to include the compatibility variants, as described in the previous section.

It's not the exact solution you are looking for, but hopefully helps ,at least, a bit.

P.S. the problem, which might occur with this path is the add-ons, if they haven't been ported to Vaadin8. Then you will need to update the dependencies of our own and replace incompatible ones.

anasmi
  • 2,562
  • 1
  • 13
  • 25
  • This is a really great solution. It is the exact solution to my problem. I converted all Vaadin7 directories like TextField, Label, CheckBox, etc using com.vaadin.v7 and at the same time, this solution allows me to use Vaadin8 directories like TreeGrid, Filesystem DataProvider, etc. Your answer saves my day. Thank you again :) – Swagat Apr 09 '19 at 09:38