0

I am a newbie in the areas in Grails and Vaadin 8, and I’m having a bit of trouble trying to add widgets to my Vaadin/Grails application.

To begin, I created a grails/Vaadin app using the me.przepiora.vaadin-grails:web-vaadin8:0.3 profile. I edited the build.gradel file, as advised and ran the command ”gradle wrapper --gradle-version 4.0” (again, as advised by the profile setup).

Here is my build.gradle after applying the edit:

apply plugin:"com.devsoap.plugin.vaadin"

buildscript {
    repositories {
        mavenLocal()
        maven { url "https://repo.grails.org/grails/core" }
        maven { url "https://dl.bintray.com/macprzepiora/gradle-plugins/" }
    }
    dependencies {
        classpath "org.grails:grails-gradle-plugin:$grailsVersion"
        classpath "org.grails.plugins:hibernate5:${gormVersion-".RELEASE"}"
        classpath "com.devsoap.plugin:gradle-vaadin-plugin:1.2.0.beta1-macprzepiora2"
        classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.14.8"
    }
}

version "0.1"
group "foobar"

apply plugin:"eclipse"
apply plugin:"idea"
apply plugin:"war"
apply plugin:"org.grails.grails-web"
apply plugin:"asset-pipeline"
apply plugin:"org.grails.grails-gsp"

repositories {
    mavenLocal()
    maven { url "https://repo.grails.org/grails/core" }
}

dependencies {
    compile "org.springframework.boot:spring-boot-starter-logging"
    compile "org.springframework.boot:spring-boot-autoconfigure"
    compile "org.grails:grails-core"
    compile "org.springframework.boot:spring-boot-starter-actuator"
    compile "org.springframework.boot:spring-boot-starter-tomcat"
    compile "org.grails:grails-web-boot"
    compile "org.grails:grails-logging"
    compile "org.grails:grails-plugin-rest"
    compile "org.grails:grails-plugin-databinding"
    compile "org.grails:grails-plugin-i18n"
    compile "org.grails:grails-plugin-services"
    compile "org.grails:grails-plugin-url-mappings"
    compile "org.grails:grails-plugin-interceptors"
    compile "org.grails.plugins:cache"
    compile "org.grails.plugins:async"
    compile "org.grails.plugins:scaffolding"
    compile "com.vaadin:vaadin-spring-boot-starter:2.+"
    compile "org.grails.plugins:events"
    compile "org.grails.plugins:hibernate5"
    compile "org.hibernate:hibernate-core:5.1.5.Final"
    compile "org.grails.plugins:gsp"
    console "org.grails:grails-console"
    profile "me.przepiora.vaadin-grails:web-vaadin8:0.3"
    runtime "org.glassfish.web:el-impl:2.1.2-b03"
    runtime "com.h2database:h2"
    runtime "org.apache.tomcat:tomcat-jdbc"
    runtime "com.bertramlabs.plugins:asset-pipeline-grails:2.14.8"
    testCompile "org.grails:grails-gorm-testing-support"
    testCompile "org.grails:grails-web-testing-support"
}

bootRun {
    jvmArgs('-Dspring.output.ansi.enabled=always')
    addResources = true
    String springProfilesActive = 'spring.profiles.active'
    systemProperty springProfilesActive, System.getProperty(springProfilesActive)
}

plugins {
    id 'com.devsoap.plugin.vaadin' version '1.3.1'
}

assets {
    minifyJs = true
    minifyCss = true
}

The resulting grails/Vaadin app worked fine, displaying a button which , when pressed, displayed an error message. I then tried to enhance the app slightly, by replacing the button with a Vaadin Tree, backup by a TreeData instance.

Unfortunately, when I did this, I got the error message:

“Widgetset 'com.vaadin.DefaultWidgetSet' does not contain implementation for com.vaadin.ui.Tree Check its component connector's @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.”

After a google search I found something that appeared to be related at:

How do I fix 'com.vaadin.DefaultWidgetSet' does not contain implementation for com.vaadin.addon.charts.Chart

Based on this, I added the line @Widgetset("AppWidgetset") to my GrailsUI class (the only class in my project that inherits from com.vaadin.ui.UI).

After doing this, I get a new runtime error:

“Failed to load the widgetset: ./VAADIN/widgetsets/AppWidgetset/AppWidgetset.nocache.js?1525623851485”

I feel so frustrated - it feels like i’m really close to a working application, if only I knew the magi incantation :-(

Andy
  • 523
  • 6
  • 20
  • Which Vaadin version are you including? As far as I know, the tree component was added in 8.1, so the if you use the default widgetset it should be the same version. – Steffen Harbich May 07 '18 at 06:23
  • I'm using V8.4.1, extracted from the file vaadin-all-8.4.1.zip which I downloaded from the Vaadin web site. Some day, I'd like to get grails to load this for me. I assuming this is possible, if grails is like most other dependency management systems, such as Maven, SBT etc. – Andy May 07 '18 at 08:48
  • Maybe you can add the gradle file to the question for details. (And dependencies can be added there.) – Steffen Harbich May 07 '18 at 11:08
  • Nice idea @SteffenHarbich but how do I add it? There's quite a lot of text and it includes SO markup characters such as curly brace and quotes? – Andy May 07 '18 at 12:20
  • Click 'edit', then in the question's text field paste code at the appropriate position, select it and press the code toolbar button (the icon with curly braces, or Ctrl+K). This will format as code (which is just adding 4 spaces in front of each line). – Steffen Harbich May 07 '18 at 12:45
  • @SteffenHarbich done :-) – Andy May 07 '18 at 16:58
  • I wonder how you included Vaadin by using the downloaded file? I would assume Vaadin is already pulled in by "com.vaadin:vaadin-spring-boot-starter:2+" dependency. So it will be automatically downloaded by gradle build. – Steffen Harbich May 08 '18 at 06:34
  • I manually added it to the intellij library list. I can easily regenerate the project without performing that step. Lemme try and get back to you. – Andy May 08 '18 at 06:47
  • @SteffenHarbich, I rebuilt the entire project from scratch, without going via intellij at all. I edited the build.gradle to use the latest com.vaadin:vaadin-spring-boot-starter:3.+. Unfortunately, it now fails at the compile stage, since it cannot find the Tree or TreeData classes. i've looked at the vaadin-plugin documentation, but this only seems to go up to V 7.x - which pre-dates the tree widget. – Andy May 08 '18 at 08:51
  • I have now managed to get two vaadin projects working using maven and the vaadin grails plugin. Looks like the grails vaadin profile might be broken – Andy May 08 '18 at 13:33

0 Answers0