Unable to get Vaadin project to compile after computer reinstalation

Hi,

I had to reinstall my machine and backuped a bigger vaadin project. After that I reinstalled Eclipse+ VaadinPlugin.
Before reinstall I used Vaadin 7.3 and after reinstalling noted inmediatly it would be more easy to create a new vaadin 7.7.8 project and migrating my source code instead of trying to get the old project to run.

I did note the different project structure and that the build system changed from ivy to maven. I am fighting now four days to a custom widget included inside this project to compile, that uses Henri Kerolas gwt-graphics-1.0.0 add on, without any success so far. The error messages produced by widget set compilation are:


The type org.vaadin.gwtgraphics.client.VectorObject cannot be resolved. It is indirectly referenced from required .class files VisionDataModelEditorWidget.java /vcweb/src/main/java/com/example/vcweb/widgetset/client

and

[b]
GWT Module org.vaadin.gwtgraphics.GWTGraphics not found in project sources or resources. (com.vaadin:vaadin-maven-plugin:7.7.8:compile:default:process-classes)

org.apache.maven.plugin.MojoExecutionException: GWT Module org.vaadin.gwtgraphics.GWTGraphics not found in project sources or resources.
at org.codehaus.mojo.gwt.shell.CompileMojo.compilationRequired(CompileMojo.java:701)
at org.codehaus.mojo.gwt.shell.CompileMojo.compile(CompileMojo.java:567)
at org.codehaus.mojo.gwt.shell.CompileMojo.doExecute(CompileMojo.java:435)
at org.codehaus.mojo.gwt.shell.AbstractGwtShellMojo.execute(AbstractGwtShellMojo.java:182)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:331)
at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1362)
at org.eclipse.m2e.core.internal.embedder.MavenImpl$11.call(MavenImpl.java:1)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:176)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:112)
at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1360)
at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:52)
at com.vaadin.integration.eclipse.maven.VaadinMojoExecutionBuildParticipant.build(VaadinMojoExecutionBuildParticipant.java:87)
[/b]

I am running out of ideas, so any help on this really appreciated. I will attach a screen shot of the project structure and source code, which I suspect to be related with the error.


The class VisionDataEditorWidget cannot compile because it is missing all imports org.vaadin.gwtgraphics.client.*

package com.example.vcweb.widgetset.client;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Random;

import org.vaadin.gwtgraphics.client.DrawingArea;
import org.vaadin.gwtgraphics.client.Line;
import org.vaadin.gwtgraphics.client.VectorObject;
import org.vaadin.gwtgraphics.client.shape.Rectangle;

import com.example.vcweb.widgetset.client.DataModelEditorWidgetConfiguration.AlignType;
import com.example.vcweb.widgetset.client.drawable.DrawableManager;
import com.example.vcweb.widgetset.client.drawable.def.Drawable;
import com.example.vcweb.widgetset.client.drawable.def.Drawable.Point;
import com.example.vcweb.widgetset.client.drawable.def.VisionProcessorDrawable;
import com.example.vcweb.widgetset.client.drawable.impl.ShapeWithTextDrawable;
import com.example.vcweb.widgetset.client.drawable.impl.ShapeWithTextDrawable.ShapeType;
import com.google.gwt.dom.client.Document;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.DomEvent;
import com.google.gwt.event.dom.client.MouseDownEvent;
import com.google.gwt.event.dom.client.MouseDownHandler;
import com.google.gwt.event.dom.client.MouseMoveEvent;
import com.google.gwt.event.dom.client.MouseMoveHandler;
import com.google.gwt.event.dom.client.MouseUpEvent;
import com.google.gwt.event.dom.client.MouseUpHandler;
import com.google.gwt.event.dom.client.MouseWheelEvent;
import com.google.gwt.event.dom.client.MouseWheelHandler;
import com.vaadin.client.ui.VPanel;

public class VisionDataModelEditorWidget extends VPanel
        implements MouseDownHandler, MouseUpHandler, MouseMoveHandler, MouseWheelHandler, ClickHandler {


private DrawingArea _dwArea = null;
    private long _gridMap;
    private boolean _dragGrid;
    private boolean _clicked = false;
    ViewPortState _zoomState = null;
    public DrawableManager _dwmanager;
    Random rand = new Random(34456747L);

    public List<ShapeWithTextDrawable> _texts;

    public VisionDataModelEditorWidget()
    {
        super();
        // setSize(SCREEN_SIZE + "px", SCREEN_SIZE + "px");
        _dwmanager = new DrawableManager();
        _texts = new ArrayList<ShapeWithTextDrawable>();
        _gridMap = new long[GRIDX_SIZE]
[GRIDY_SIZE]
;
        _dwArea = new DrawingArea(SCREEN_SIZE, SCREEN_SIZE);
        _dwArea.setStyleName("screen");
        _dwArea.addMouseDownHandler(this);
        _dwArea.addMouseUpHandler(this);
        _dwArea.addMouseMoveHandler(this);
        _dwArea.addMouseWheelHandler(this);
        _dwArea.addClickHandler(this);
        add(_dwArea);

        _zoomState = new ViewPortState();
        drawViewport(_zoomState);
        _dragGrid = false;
    }


VcWebWidgetSet.gwt.xml has the following content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN" "http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd">
<module>
    <inherits name="com.vaadin.DefaultWidgetSet" />
    <inherits name='com.google.gwt.user.User'/>
    <inherits name='com.google.gwt.user.theme.standard.Standard'/>
    <inherits name='com.google.gwt.event.Event'/>
    <inherits name='org.vaadin.gwtgraphics.GWTGraphics'/>
    <source path="client" />
    
    <!--
     Uncomment the following to compile the widgetset for one browser only.
      
     Multiple browsers can be specified as a comma separated list. The
     supported user agents at the moment of writing were:
     ie8,ie9,gecko1_8,safari,opera
     
     The value gecko1_8 is used for Firefox and safari is used for webkit
     based browsers including Google Chrome.
    -->
    <!-- <set-property name="user.agent" value="safari"/> -->
    
    <!--
     To enable SuperDevMode, uncomment this line.
     
     See https://vaadin.com/wiki/-/wiki/Main/Using%20SuperDevMode for more
     information and instructions.
    -->
     <set-configuration-property name="devModeRedirectEnabled" value="true" />
         
</module>


pom.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>vcweb</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>vcweb</name>

    <prerequisites>
        <maven>3</maven>
    </prerequisites>

    <properties>
        <vaadin.version>7.7.8</vaadin.version>
        <vaadin.plugin.version>7.7.8</vaadin.plugin.version>
        <jetty.plugin.version>9.3.9.v20160517</jetty.plugin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <!-- If there are no local customisations, this can also be "fetch" or "cdn" -->
        <vaadin.widgetset.mode>local</vaadin.widgetset.mode>
    </properties>

    <repositories>
        <repository>
             <id>vaadin-addons</id>
               <url>http://maven.vaadin.com/vaadin-addons</url>
        </repository>
    </repositories>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <version>${vaadin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-server</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-push</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client-compiled</artifactId>
        </dependency>
            <dependency>
               <groupId>org.vaadin.addons</groupId>
               <artifactId>gwt-graphics</artifactId>
               <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client-compiler</artifactId>
        </dependency>
        <dependency>
                <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-themes</artifactId>
        </dependency>
    
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <!-- Exclude an unnecessary file generated by the GWT compiler. -->
                    <packagingExcludes>WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.plugin.version}</version>
                
                <configuration>
                    <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
                    <draftCompile>false</draftCompile>
                    <compileReport>false</compileReport>
                    <style>OBF</style>
                    <strict>true</strict>
                  </configuration>
  
                <executions>
                    <execution>
                        <goals>
                            <goal>update-theme</goal>
                            <goal>update-widgetset</goal>
                            <goal>compile</goal>
                            <!-- Comment out compile-theme goal to use on-the-fly theme compilation -->
                            <goal>compile-theme</goal>
                        </goals>
                    </execution>
                </executions>
            
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.0.0</version>
                <!-- Clean up also any pre-compiled themes -->
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/main/webapp/VAADIN/themes</directory>
                            <includes>
                                <include>**/styles.css</include>
                                <include>**/styles.scss.cache</include>
                            </includes>
                        </fileset>
                        <fileset>
                                <directory>src/main/webapp/VAADIN/widgetsets</directory>
                         </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <!-- The Jetty plugin allows us to easily test the development build by
                running jetty:run on the command line. -->
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.plugin.version}</version>
                <configuration>
                    <scanIntervalSeconds>2</scanIntervalSeconds>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- Vaadin pre-release repositories -->
            <id>vaadin-prerelease</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>

            <repositories>
                <repository>
                    <id>vaadin-prereleases</id>
                    <url>http://maven.vaadin.com/vaadin-prereleases</url>
                </repository>
                <repository>
                    <id>vaadin-snapshots</id>
                    <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>vaadin-prereleases</id>
                    <url>http://maven.vaadin.com/vaadin-prereleases</url>
                </pluginRepository>
                <pluginRepository>
                    <id>vaadin-snapshots</id>
                    <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>

</project>

Thanks for every hint on this, I am almost desillusionated!
32215.png

Hi,

There are a couple of things you can try to debug the issue:

  • It seems like the problem is with GWTGraphics only. You can try and make sure by not including it.

If this is the only problem, then you can try and let the widgetset compilation create your gwt.xml file. Add the GWTGraphics back in and delete your VcWebWidgetSet.gwt.xml. The widgetset compilitaion will create the gwt.xml file based on the ones found in the references jars. It should then add back something like:

Before doing anything else it might be a good idea to clean everything up properly: manually delete the build directory, delete the cached version of the gwtgraphics jar in Maven’s .m2 directory, run Maven update in Eclipse.

Hope this helps,
Pontus

Hello, thanks for your help so far,

… but I need more Input. I followed your suggestions. Basically I started again with a fresh project (Eclipse-Plugin, vaadin-archetype-application). Then I copied all old source to the folder src/main/java, which in my old project was only /src, but I assume this should not make a difference.

If you have again a look at the picture of the project structure, all the client side code for my widget was contained in the package com.example.vcweb.widgetset.client. This time I omitted to copy VcWebWidgetSet.gwt.xml to com.example.vcweb.widgetset, with the effect that the error:


The type org.vaadin.gwtgraphics.client.VectorObject cannot be resolved. It is indirectly referenced from required .class files VisionDataModelEditorWidget.java /vcweb/src/main/java/com/example/vcweb/widgetset/client

disappeared, but when performing manual widgetset compilation (pressing the eclipse button), on the console it is obvious, that Vaadin now doesn’t detect my widget set anymore and chooses:

Widgetsets found from classpath:
[INFO]
com.vaadin.DefaultWidgetSet in jar:file:C:/Users/Amfib/.m2/repository/com/vaadin/vaadin-client/7.7.8/vaadin-client-7.7.8.jar!/
[WARNING]
GWT plugin is configured to detect modules, but none were found.

Now I copied back VcWebWidgetSet.gwt.xml to its old location com.example.vcweb.widgetset and at first it seems the error is gone, but widget set compilation shows:

[INFO]
— vaadin-maven-plugin:7.7.8:compile (default-cli) @ VCWeb —
[INFO]
auto discovered modules [com.example.vcweb.widgetset.VcWebWidgetSet]

[INFO]
com.example.vcweb.widgetset.VcWebWidgetSet is up to date. GWT compilation skipped

So at the moment I am not sure, if the widgetset was really compiled. I revert my last statement, I detected the folder D:\Coding\workspace\VCWeb\target\classes\VAADIN\widgetsets. I suspect this is the product of widget set compilation, correct?

I will now continue evaluating if my old project not only compiles but also runs, but I have still some questions remaining on the new project structure of a Vaadin 7.7.8 project.

  1. When creating a new project (Eclipse-Plugin, vaadin-archetype-application), there is no parameter widgetsetName likein the other archetypes. Does this mean that vaadin-archetype-application assumes you won’t extend the Default Widget Set?
    If you provide widgetsetName=???, is this taken in consideration by the eclipse plugin?

  2. Vaadin 7.3 contained a folder WebContent. Obivously this folder is gone. My first guess is, that it was replaced by src/main/webapp because this contains VAADIN/themes. But it does not contain VAADIN/gwt-unitCache and VAADIN/widgetsets. So basically I am not sure if I have to migrate the content of the old WebContent folder and to which location. Especifically ./WebContent/META-INF, ./WebContent/WEB-INFO/web.xml, ./WebContent/Vaadin/gwt-unitCache and widgetsets and ./WebContent/VAADIN/themes/VCWebTheme/img (all application icons)

  3. I have also doubts about the new folder src/main/resources in a VAADIN 7.7.8 project. While intenting to solve my initial problem I found various hints, that this is supposed to be the new location for widgetset.gwt.xml although in my actual solution it maintains in its original location /src/main/java/com/example/vcweb/widgetset where my custom widgetset code resides. Now is this correct? Is the resource folder supposed to contain only the gwt-descriptor, all the custom widgetset code, perhaps although all the static resources that before where in the WebContent folder?

  4. At the end I detected this help page on the VAADIN webspace http://vaadin.com/download/release/7.7/7.7.0/release-notes.html#gwtdep and applied the hints section GWT dependency changes. Is it possible that at the end, this was the solution to my compile problem?

If you Pontus, or someone else can clearify this questions. Thanks. After working 1 year with VAADIN on a spare time project I also would like to describe a bit my experience and provide some critical feedback about things, that are / were difficult and probably can be improved. If there is interest in such feedback, what would be a good place to comment?

Best wishes from Mexico

After digging a bit more in the internet and reading Vaadin 8 documentation, I have another speculation about the disappearance of my WebContent folder.
Is it possible that Vaadin 7.3 Eclipse plugin automatically installed WebToolsProject and some component in WTP executes the deploy of the VaadinApplication (create the WebContent folder and copies all the resources, that I don’t know where to put them).
If so, then l have basically two options:
-Install WTP in my plain Eclipse Neon (NO JavaEE) edition
-follow the instructions in https://vaadin.com/docs/-/part/framework/application/application-environment.html and deploy by hand

I am going to start now my own experiments, but independent of success / failure, a confirmation would be nice.

Thanks

Jens

Hi,

My previous answer was not very good, sorry about that. The vaadin-archetype-application Maven archetype assumes that you use the default widgetset, and you have to make some modifications to make things work.

  1. In the pom.xml, change the dependency “vaadin-client-compiled” → “vaadin-client”.
  2. Then you need to provide the “gwt.xml” file, since your project contains client-side code. This file goes in the “resources” folder. The path to the file should match the package structure (in this case it would become something like “resource/com/example/vcweb/widgetset/VcWebWidgetSet.gwt.xml”).
  3. Then you need to add an annotation to the UI to use the widgetset @Widgetset(“com.example.vcweb.widgetset.VcWebWidgetSet”)

After that compiling with maven “mvn vaadin:compile” should compile the widgetset. A new version of the Vaadin plugin will do the same thing (the old Ivy based one will not work).

The WebContent folder isn’t generated by the archetype. It is something that Eclipse has done. The project might have the wrong facet or something that makes Eclipse generate it. Stuff in there will not be used when building with Maven as far as I know. The folder “webapp” should be used instead.

Eclipse should be able to deploy these projects just as the old one, just add to server.

Hope this helps,
Pontus