GWT project doesn't migrate to Vaadin 7

There’s a complex GWT project that was decided to migrate to Vaadin 7 (because it is easy, at least https://vaadin.com/gwt says so).
But there’s one thing that differs from case described on site. The project uses GWT but is compiled via maven compile plugin (gwt:compile finishes with error due to specificity of a project).
Here are the settings before and after migration actions, and errors after build start. Hope you can help me to finish migration.

Before:

/*root pom.xml*/
<plugin>
     <groupId>com.ning.maven.plugins</groupId>
     <artifactId>maven-duplicate-finder-plugin</artifactId>
     <version>${maven-duplicate-finder-plugin.version}</version>
     <configuration>
        <failBuildInCaseOfConflict>true</failBuildInCaseOfConflict>
        <useDefaultResourceIgnoreList>true</useDefaultResourceIgnoreList>
        <ignoredResources>
          ...
        </ignoredResources>
        <exceptions>
                ....
               <exception>
                   <conflictingDependencies>
                        <dependency>
                            <groupId>com.google.gwt</groupId>
                            <artifactId>gwt-dev</artifactId>
                            <version>${google.gwt.version}</version>
                         </dependency>
                         <dependency>
                              <groupId>com.google.gwt</groupId>
                              <artifactId>gwt-user</artifactId>
                              <version>${google.gwt.version}</version>
                          </dependency>
                          <dependency>
                               <groupId>com.google.gwt</groupId>
                               <artifactId>gwt-servlet</artifactId>
                               <version>${google.gwt.version}</version>
                           </dependency>
                           <!--<dependency>
                                <groupId>javax.servlet</groupId>
                                <artifactId>servlet-api</artifactId>
                                <version>${servlet.api.version}</version>
                            </dependency>-->

After:

 
...
        <exception>
            <conflictingDependencies>
                  <!--<dependency>
                      <groupId>javax.servlet</groupId>
                      <artifactId>servlet-api</artifactId>
                      <version>${servlet.api.version}</version>
                  </dependency>-->

                  <!-- this replaces gwt-user.jar -->
                  <dependency>
                      <groupId>com.vaadin</groupId>
                      <artifactId>vaadin-client</artifactId>
                      <version>7.0.0.beta9</version>
                      <scope>provided</scope>
                   </dependency>
                   <!-- this replaces gwt-dev.jar -->
                   <dependency>
                       <groupId>com.vaadin</groupId>
                       <artifactId>vaadin-client-compiler</artifactId>
                       <version>7.0.0.beta9</version>
                       <scope>provided</scope>
                    </dependency>
                    <!-- optional - this replaces gwt-servlet.jar etc. and is deployed on the server -->
                    <dependency>
                         <groupId>com.vaadin</groupId>
                         <artifactId>vaadin-server</artifactId>
                         <version>7.0.0.beta9</version>
                     </dependency>

Before:

/*module where gwt is used pom.xml*/
<plugin>
     <groupId>org.codehaus.mojo</groupId>
     <artifactId>gwt-maven-plugin</artifactId>
     <version>${gwt-maven-plugin.version}</version>
     <configuration>
              <!-- **************************************************** -->
              <!-- *** The specific GWT version features are used   *** -->
              <!-- *** in code (1.5.3 by default)                   *** -->
              <!-- **************************************************** -->
              <gwtVersion>${google.gwt.version}</gwtVersion>

              <!-- Java memory allocation for GWT compiler -->
              <extraJvmArgs>-Xms512M -Xmx1024M -XX:PermSize=128m -XX:MaxPermSize=256m -Xss1024k</extraJvmArgs>
              <modules>
                   <module>/*starting module client*/</module>
                   <module>/*starting module admin*/</module>
               </modules>
     </configuration>
     <executions>
        <execution>
           <goals>
              <goal>compile</goal>
           </goals>
           <configuration>
                <!-- ********************************************************* -->
                <!-- *** This prevents using the unfiltered resources from *** -->
                <!-- *** src/main/resources prior of filtered resources    *** -->
                <!-- *** from target/classes                               *** -->
                <!-- *** (or target/<web_app_name>/WEB-INF/classes)        *** -->
                <!-- ********************************************************* -->
                <resourcesOnPath>false</resourcesOnPath>
                <generateDirectory>${project.build.directory}/generated-sources/gwt</generateDirectory>
                <genParam>true</genParam>
                <gen>${project.build.directory}/generated-sources/gwt</gen>
                <compileReport>true</compileReport>
                <enableAssertions>${gwt.compiler.enableAssertions}</enableAssertions>
                <style>${gwt.compiler.style}</style>
          </configuration>
        </execution>
     </executions>
 </plugin>

After:


<plugin>
     <groupId>com.vaadin</groupId>
     <artifactId>vaadin-maven-plugin</artifactId>
     <version>7.0.0.beta9</version>
     <configuration>
         <!-- **************************************************** -->
         <!-- *** The specific GWT version features are used   *** -->
         <!-- *** in code (1.5.3 by default)                   *** -->
         <!-- **************************************************** -->
         <!--<gwtVersion>${google.gwt.version}</gwtVersion>-->
      
          <!-- Java memory allocation for GWT compiler -->
          <extraJvmArgs>-Xms512M -Xmx1024M -XX:PermSize=128m -XX:MaxPermSize=256m -Xss1024k</extraJvmArgs>
          <modules>
           .....


updated

When I perform “mvn -DskipTests=true clean install”, I receive errors during build of a module where gwt is used.
Here is a short sample of the error:

What did I miss or did wrong?

Thank you very much in advance for your help.

Looks like you still have a GWT 2.4.0 hanging around and included in your build. Likely it conflicts with Vaadin.

I found one more place where direct dependencies to gwt-user and gwt-servlet are described. So I substituted them with vaadin ones and I now receive the compilation error (it appears earlier than in previous post):

I’ll try to change imports, but I think this is not what is expected to be done for migration.


updated

I found that methods I used earlier cannot be found now. And also gwt 2.3.0 version appeared in classpath. What gwt version does vaadin use? :slight_smile:

You should not have any gwt*.jar files on your classpath. Everything you need is in the vaadin-*.jar files

What is left is the following:

<dependency>
            <groupId>com.allen-sauer.gwt.log</groupId>
            <artifactId>gwt-log</artifactId>
            <version>${google.gwt-log.version}</version>
        </dependency>
        <!-- ============================================ -->
        <!-- ===        GWT Drag And Drop library     === -->
        <!-- ============================================ -->
        <dependency>
            <groupId>com.allen-sauer.gwt.dnd</groupId>
            <artifactId>gwt-dnd</artifactId>
            <version>${google.gwt-dnd.vertion}</version>
        </dependency>
        <!-- ============================================ -->
        <!-- ===        GWT Server Side library       === -->
        <!-- ============================================ -->
        <dependency>
            <groupId>net.sf.gwt-widget</groupId>
            <artifactId>gwt-sl</artifactId>
            <version>${google.gwt-sl.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-jdbc</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-webmvc</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>cglib</groupId>
                    <artifactId>cglib-nodep</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

If I correctly understood you, I should delete them also.

Additional libraries such as GWT Drag And Drop are not included, only gwt-*.jar which is included in the standard GWT distribution. It is possible that you need to add an exclusion to the GWT libraries you use so they do not include gwt-dev.jar and/or gwt-user.jar as their dependencies.

Yes, you were right. Adding gwt-dev and gwt-user as exclusions corrected the build process and at last I received my .war file :slight_smile:
Now I try to launch it, but there’re some errors due to lack (I think) of servlet-api.jar. Hope this is not an issue at all (I’ll reexamine POMs).

Btw, now it should work as a vaadin app, right? I mean, all checks - client and server - will be made on server and browser “injections” won’t work anymore (I hope) :slight_smile:

If you only compile your application with Vaadin JARs, that does not change anything in where each piece of code is executed.

Using Vaadin JARs gives you the possibility to also code parts or all of your application to run on the server side, but any GWT code you compile with Vaadin JARs still runs exactly the same way it did on the browser. There is no magic bullet to moving an existing client side application to run on the server side - you need to rewrite (significant) parts of it, while perhaps keeping some custom client side widgets you have developed etc.

However, mixing GWT client side and Vaadin server side code is probably easier than mixing similar code with many other frameworks. How exactly that can be done is so case specific that I cannot give a general recipe for it, but see e.g.
this thread
for one case and approach.

To make a long message (that I do not have to finish right now, sorry) short: For many, a Vaadin application is where everything happens on the server side, and the client side is pretty dump, only used for display. For me, this is just one way to use Vaadin, but there are many more now. For me, a good Vaadin 7 application uses the advantages of both sides. You have the GWT frontend available, so use it. There is nothing wrong with this. And even when you just use Vaadin as a simple way to access and store your data, there is already a lot to gain.

Sorry that I need to stop here for now. Happy to discuss this topic more here on the forum. Off to work on my new Vaadin Widget with lots of client side code :slight_smile:

Everything works well. By the way, vaadin-client has indirect dependency to vaadin-server. So if you already added vaadin-client, there’s no need in adding dependency to vaadin-server :slight_smile: