gradlevaadinvaadin8vaadin4spring

Error using Gradle Vaadin Plugin


I am trying to add Gradle Vaadin Plugin to my project, but I get the below error.

Errors in 'jar:file:/C:/Users/DEMO/.gradle/caches/modules-2/files-2.1/com.google.gwt/gwt-user/2.8.1/9a13fbee70848f1f1cddd3ae33ad180af3392d9e/gwt-user-2.8.1.jar!/com/google/gwt/vali
dation/client/impl/GwtValidatorContext.java'
Line 29: The type GwtValidatorContext must implement the inherited abstract method ValidatorContext.parameterNameProvider(ParameterNameProvider)
Tracing compile failure path for type 'com.vaadin.client.communication.AtmospherePushConnection'
Errors in 'jar:file:/C:/Users/DEMO/.m2/repository/com/vaadin/vaadin-client/8.0.6/vaadin-client-8.0.6.jar!/com/vaadin/client/communication/AtmospherePushConnection.java'
Line 212: PUSH_ID_PARAMETER cannot be resolved or is not a field
Tracing compile failure path for type 'javax.validation.executable.ExecutableValidator'
Errors in 'jar:file:/C:/Users/DEMO/.gradle/caches/modules-2/files-2.1/javax.validation/validation-api/1.1.0.Final/7d49b53caed9bd81d172807c3e096d24f3c57090/validation-api-1.1.0.Fina
l-sources.jar!/javax/validation/executable/ExecutableValidator.java'
Line 53: No source code is available for type java.lang.reflect.Method; did you forget to inherit a required module?
Line 94: No source code is available for type java.lang.reflect.Constructor<T>; did you forget to inherit a required module?
Tracing compile failure path for type 'com.vaadin.client.communication.MessageHandler'
Errors in 'jar:file:/C:/Users/DEMO/.m2/repository/com/vaadin/vaadin-client/8.0.6/vaadin-client-8.0.6.jar!/com/vaadin/client/communication/MessageHandler.java'
Line 358: UIDL_PUSH_ID cannot be resolved or is not a field
Line 359: UIDL_PUSH_ID cannot be resolved or is not a field
Tracing compile failure path for type 'com.google.gwt.validation.client.impl.PropertyDescriptorImpl'
Errors in 'jar:file:/C:/Users/DEMO/.gradle/caches/modules-2/files-2.1/com.google.gwt/gwt-user/2.8.1/9a13fbee70848f1f1cddd3ae33ad180af3392d9e/gwt-user-2.8.1.jar!/com/google/gwt/vali
dation/client/impl/PropertyDescriptorImpl.java'
Line 31: The type PropertyDescriptorImpl must implement the inherited abstract method CascadableDescriptor.getGroupConversions()
Errors in 'jar:file:/C:/Users/DEMO/.gradle/caches/modules-2/files-2.1/com.google.gwt/gwt-user/2.8.1/9a13fbee70848f1f1cddd3ae33ad180af3392d9e/gwt-user-2.8.1.jar!/com/google/gwt/vali
dation/client/impl/ConstraintDescriptorImpl.java'
Line 35: The type ConstraintDescriptorImpl<T> must implement the inherited abstract method ConstraintDescriptor<T>.getMessageTemplate()
Line 35: The type ConstraintDescriptorImpl<T> must implement the inherited abstract method ConstraintDescriptor<T>.getValidationAppliesTo()
Tracing compile failure path for type 'com.google.gwt.validation.client.impl.GwtBeanDescriptorImpl'

Here is the page for the plugin: https://github.com/johndevs/gradle-vaadin-plugin/wiki

And, here is my build.gradle file:

buildscript {
    ext {
        springBootVersion = '1.5.3.RELEASE'
    }
    repositories {
        mavenCentral()

        maven {
      url "http://maven.vaadin.com/vaadin-addons"
    }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

plugins {  
    id 'com.devsoap.plugin.vaadin' version '1.2.1'
        id 'org.springframework.boot' version '1.5.3.RELEASE'
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'jacoco'
apply plugin: 'application'

jar {
    baseName = 'testapp'
    version = '0.0.1-SNAPSHOT'
}

sourceCompatibility = 1.8

repositories {
    mavenCentral()
        flatDir {
       dirs 'libs'
   }
    maven {
      url "http://maven.vaadin.com/vaadin-addons"
  }
}

sourceSets {
  main {
    output.resourcesDir = "build/classes/main"
  }

  uiTest {
      java.srcDirs=['src/ui-test/java','src/main/java']
      resources.srcDir 'src/ui-test/resources'
      compileClasspath += main.output + test.output
      runtimeClasspath += main.output + test.output
  }
}

dependencies {
  compile('org.springframework.boot:spring-boot-starter-jersey')
  compile('org.springframework.boot:spring-boot-starter-web')
  testCompile('org.springframework.boot:spring-boot-starter-test')
  testCompile('org.springframework.restdocs:spring-restdocs-mockmvc')

  // Spring Boot Security
  compile("org.springframework.boot:spring-boot-starter-security")
  compile("org.springframework.security.oauth:spring-security-oauth2")
  compile('org.springframework.security:spring-security-ldap')

  // Spring Actuator
  compile("org.springframework.boot:spring-boot-starter-actuator")

  // Spring Boot JDBC Starter 
  compile("org.springframework.boot:spring-boot-starter-jdbc")

  // Vaadin
  compile('com.vaadin:vaadin-spring-boot-starter')
  compile('com.vaadin:vaadin-push')

  // Vaadin add-ons
  compile("org.vaadin.spring.addons:vaadin-spring-addon-eventbus:2.0.0.RELEASE")

  //Vaadin extentions 
  compile("org.vaadin.spring.extensions:vaadin-spring-ext-security:2.0.0.RELEASE")

  // Lombok
  compile("org.projectlombok:lombok")

    // MyBatis
  compile("org.mybatis:mybatis-spring:1.2.3")
  compile("org.mybatis:mybatis:3.3.0")

  // BoneCP - Connection Pooling
  compile("com.jolbox:bonecp:0.8.0.RELEASE")

  // PostgreSQL
  compile("org.postgresql:postgresql:9.4-1204-jdbc42")  

  //Vaadin Testbench
  uiTestCompile("com.vaadin:vaadin-testbench:5.0.0")


  //TypeAhead widget
  compile name: 'typeaheadSearchBox-1.0-SNAPSHOT'

}

// Create a new task called uiTest and set its type to Test.
// Configure the location of the compiled test classes.
// Configure the classpath that is used when our integration tests are run.

configurations {
  uiTestCompile.extendsFrom testCompile
  uiTestRuntime.extendsFrom testRuntime
}
task uiTest(type: Test) {
  testClassesDir = sourceSets.uiTest.output.classesDir
  classpath = sourceSets.uiTest.runtimeClasspath
}

dependencyManagement {
    imports {
        mavenBom "com.vaadin:vaadin-bom:8.0.3"
    }
}

jacocoTestReport {
    reports {
        xml.enabled = true
        html.enabled = true
    }
}

check.dependsOn jacocoTestReport

springBoot {  
  // Main class of @SpringBootApplication
  mainClass = 'com.sample.test.Application'
}

When I check the gradle dependencies, I see 2 version of the "javax.validation:validation-api". I believe that is causing the problem, but I could not find a way to force vaadin-client to use "javax.validation:validation-api:1.0.0.GA".

I appreciate if you can help me to correct the build.gradle.


Solution

  • The Gradle Vaadin plugin must see the Springboot plugin to do a proper setup. So you have to first use the Springboot plugin, then afterwards the Vaadin plugin.

    The reason for the error you see there is, that the dep for javax.validation 1.1 from Springboot overrides all configurations (also the one used to build the client for Vaadin)

    On a side note: you apply the Springboot plugin twice -- once in plugins, once with apply. I'd get rid of the buildscript-block and the apply. Then swap the items in plugins.