Thomas
Thomas

Reputation: 88757

Vaadin compile Widgetset using Maven

I have a problem with compiling custom widgetsets for my vaadin application using Maven.

Among my maven modules there's one jar module containing the custom widgets and one war module.

The compiled jar module contains the sources as well as the generated classes and basically looks like this:

com
 |-mypackage
 |  |-ui
 |  | |- VMyWidget.class
 |  | |- VMyWidget.java
 |  |- MyComponent.class
 |  |- MyComponent.java
 |  |- MyWidgetSet.gwt.xml
 |-META-INF
    |-Manifest.MF
       |-Vaadin-Widgetsets: com.mypackage.MyWidgetSet
       |-Vaadin-Package-Version: 1

In my war project the pom.xml contains the following section:

 <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>2.3.0</version>
        <configuration>
          <webappDirectory>${project.build.directory}/${project.build.finalName}/VAADIN/widgetsets</webappDirectory>
          <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
          <hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
          <noServer>true</noServer>         
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>generateAsync</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-maven-plugin</artifactId>
        <version>1.0.1</version>
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals>
              <goal>update-widgetset</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

The jar containing the widgets is a dependency of the war project and thus the widget set is defined.

However, the GWT compiler seems not to find the sources although they are contained in the jar artifact.

Thus, I get the following warning/error message:

[INFO] [ERROR] [WARN] Widget class com.mypackage.ui.VMyWidget was not found. The component com.mypackage.MyComponent will not be included in the widgetset.

What am I missing? Why doesn't the GWT compiler find the sources it needs?

Upvotes: 2

Views: 7323

Answers (2)

user983717
user983717

Reputation:

I run into this problem as well. I read thousands of answers to this topic but never found something that helped. Than I noticed that if you run tomcat as an adapter in eclipse and you deploy your project into it, then sometimes after you have build your project, the target folder is not in sync with eclipse and you have to press F5 on it. After this action the widgetset could be loaded.

Upvotes: 1

Thomas
Thomas

Reputation: 88757

I think I found the problem. The package has to be com.mypackage.client.ui, i.e. it seems like it must contain a client subpackage next to MyWidgetSet.gwt.xml. Although this is documented I overlooked that.

It seems to work now.

Upvotes: 4

Related Questions