title: Vaadin Custom Components/Widgets with Maven and Spring Boot
body: <p>I am relatively new to vaadin and started out with a spring boot application and the vaadin spring boot plugin. Everything worked fine until I got to the point where I tried to create my own components/widgets.</p>
  
  <p>Unfortunately I didn't find any "official" example/documentation how to set up custom components within a spring boot application so I had to search the web to find out how to set up additional plugin(s) in maven to compile the code for the client side widgets. As far as I can tell from the log output the compilation of these components work, but when I try to access these components on the webpage I get an error:</p>
  
  <pre><code>Widgetset 'com.vaadin.DefaultWidgetSet' does not contain implementation for net.gtidev.test.components.MyComponent. Check its component connector's @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. [...]
  </code></pre>
  
  <p>Here is the widget compiler log:</p>
  
  <pre><code>[INFO] Using com.vaadin:vaadin-client-compiler version 7.6.4
  [ERROR] Mar 22, 2016 10:22:43 AM java.util.prefs.WindowsPreferences &lt;init&gt;
  [ERROR] WARNUNG: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
  [INFO] Compiling module net.gtidev.test.components.TestWidgetset
  [INFO]    Computing all possible rebind results for 'com.vaadin.client.metadata.ConnectorBundleLoader'
  [INFO]       Rebinding com.vaadin.client.metadata.ConnectorBundleLoader
  [INFO]          Invoking generator com.vaadin.server.widgetsetutils.ConnectorBundleLoaderFactory
  [INFO]             Populating eager bundle
  
  . . . . . 250 more lines
  
  [INFO]    Computing all possible rebind results for 'com.vaadin.client.ui.dd.VAcceptCriterionFactory'
  [INFO]       Rebinding com.vaadin.client.ui.dd.VAcceptCriterionFactory
  [INFO]          Invoking generator com.vaadin.server.widgetsetutils.AcceptCriteriaFactoryGenerator
  [INFO]             Detecting available criteria ...
  [INFO]             creating mapping for com.vaadin.event.dd.acceptcriteria.AcceptAll
  [INFO]             creating mapping for com.vaadin.event.dd.acceptcriteria.And
  [INFO]             creating mapping for com.vaadin.event.dd.acceptcriteria.ContainsDataFlavor
  [INFO]             creating mapping for com.vaadin.event.dd.acceptcriteria.SourceIs
  [INFO]             creating mapping for com.vaadin.ui.AbstractSelect.TargetItemIs
  [INFO]             creating mapping for com.vaadin.ui.AbstractSelect.AcceptItem
  [INFO]             creating mapping for com.vaadin.ui.Table.TableDropCriterion
  [INFO]             creating mapping for com.vaadin.ui.Tree.TreeDropCriterion
  [INFO]             creating mapping for com.vaadin.event.dd.acceptcriteria.Not
  [INFO]             creating mapping for com.vaadin.event.dd.acceptcriteria.Or
  [INFO]             creating mapping for com.vaadin.event.dd.acceptcriteria.ServerSideCriterion
  [INFO]             creating mapping for com.vaadin.event.dd.acceptcriteria.SourceIsTarget
  [INFO]             creating mapping for com.vaadin.event.dd.acceptcriteria.TargetDetailIs
  [INFO]             creating mapping for com.vaadin.ui.Tree.TargetInSubtree
  [INFO]             Done. (0seconds)
  [INFO]    Compiling 1 permutation
  [INFO]       Compiling permutation 0...
  [INFO]    Compile of permutations succeeded
  [INFO]    Compilation succeeded -- 59,217s
  [INFO] Linking into C:\projects\misc\vaadin-boot\target\vaadin-boot-0.0.1-SNAPSHOT\net.gtidev.test.components.TestWidgetset
  [INFO]    Link succeeded
  [INFO]    Linking succeeded -- 0,492s
  </code></pre>
  
  <p>The files I use for my custom component were generated by the eclipse vaadin addon within a vaadin 7 project which I created only for this purpose. When I started this vaadin 7 project in eclipse the component worked. I then copied these files into my spring boot maven project where the custom component does not get loaded any more.</p>
  
  <p>I know that spring boot applications have a slightly different bootstrap mechanism and layout than "classic" webapps and that amongst other things static resources are not loaded from the webapp-folder but from the classpath:/static folder. I think that the core of the problem has something to do with this fact but I don't know what to do to fix it.</p>
  
  <p>My Plugin configuration (I tried with and without the commented options):</p>
  
  <pre><code>&lt;plugin&gt;
    &lt;groupId&gt;com.vaadin&lt;/groupId&gt;
    &lt;artifactId&gt;vaadin-maven-plugin&lt;/artifactId&gt;
    &lt;version&gt;7.6.4&lt;/version&gt;
    &lt;configuration&gt;
      &lt;strict&gt;true&lt;/strict&gt;
      &lt;force&gt;true&lt;/force&gt;
      &lt;!-- Enable during development to speed compiling. --&gt;
      &lt;!-- &lt;draftCompile&gt;true&lt;/draftCompile&gt;
      &lt;style&gt;DETAILED&lt;/style&gt; --&gt;
      &lt;!-- End development options --&gt;
      &lt;!--&lt;webappDirectory&gt;src/main/webapp/VAADIN/widgetsets&lt;/webappDirectory&gt;--&gt;
      &lt;modules&gt;
        &lt;module&gt;net.gtidev.test.components.TestWidgetset&lt;/module&gt;
      &lt;/modules&gt;
    &lt;/configuration&gt;
    &lt;executions&gt;
      &lt;execution&gt;
        &lt;goals&gt;
          &lt;goal&gt;resources&lt;/goal&gt;
          &lt;goal&gt;compile&lt;/goal&gt;
        &lt;/goals&gt;
      &lt;/execution&gt;
    &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>I tried different maven plugin combinations and configurations. In one example, there was also a Google-GWT Plugin mentioned, but running this plugin on the code produced the same log output as the vaadin plugin:</p>
  
  <pre><code>&lt;plugin&gt;
    &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
    &lt;artifactId&gt;gwt-maven-plugin&lt;/artifactId&gt;
    &lt;version&gt;2.5.1&lt;/version&gt;
    &lt;!--&lt;configuration&gt;--&gt;
    &lt;!--&lt;webappDirectory&gt;src/main/webapp/VAADIN/widgetsets&lt;/webappDirectory&gt;--&gt;
    &lt;!--&lt;extraJvmArgs&gt;-Xmx512M -Xss1024k&lt;/extraJvmArgs&gt;--&gt;
    &lt;!--&lt;runTarget&gt;clean&lt;/runTarget&gt;--&gt;
    &lt;!--&lt;hostedWebapp&gt;${project.build.directory}/${project.build.finalName}&lt;/hostedWebapp&gt;--&gt;
    &lt;!--&lt;noServer&gt;true&lt;/noServer&gt;--&gt;
    &lt;!--&lt;port&gt;8080&lt;/port&gt;--&gt;
    &lt;!--&lt;soycDetailed&gt;false&lt;/soycDetailed&gt;--&gt;
    &lt;!--&lt;/configuration&gt;--&gt;
    &lt;executions&gt;
      &lt;execution&gt;
        &lt;goals&gt;
          &lt;goal&gt;resources&lt;/goal&gt;
          &lt;goal&gt;compile&lt;/goal&gt;
        &lt;/goals&gt;
      &lt;/execution&gt;
    &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>