gradle - 使用Gradle Vaadin插件时出错

标签 gradle vaadin vaadin8 vaadin4spring

我试图将Gradle Vaadin插件添加到我的项目中,但是出现以下错误。

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'

这是插件的页面:https://github.com/johndevs/gradle-vaadin-plugin/wiki

而且,这是我的build.gradle文件:
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'
}

当检查gradle依赖项时,我看到了2版的“javax.validation:validation-api”。
我相信是造成此问题的原因,但是我找不到强制vaadin-client使用“javax.validation:validation-api:1.0.0.GA”的方法。

如果您能帮助我更正build.gradle,我们将不胜感激。

最佳答案

Gradle Vaadin插件必须看到Springboot插件才能进行正确的设置。因此,您必须首先使用Springboot插件,然后再使用Vaadin插件。

您看到的错误的原因是,Springboot的javax.validation 1.1的dep会覆盖所有配置(也是用于构建Vaadin客户端的配置)

附带说明一下:您将两次应用Springboot插件-一次在plugins中,一次在apply中。我将摆脱buildscript -block和apply。然后交换plugins中的项目。

关于gradle - 使用Gradle Vaadin插件时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45817473/

相关文章:

list - aVdin 8 中的样式列表选择

gradle - 从Gradle测试依赖项中排除文件

extjs - 比较企业应用程序的 Web GUI 框架

java - Vaadin 中当前 UI 的访问方法

css - Vaadin8:如何在TextField中显示Vaadin图标?

Vaadin:在日期字段的字段焦点上打开日历

android - 使用 gitlab 页面将 Dokka Docs 上传到 maven

tomcat - 部署gradle项目到tomcat服务器

java - Gradle 构建后,Intellij Idea 未在消息工具窗口中显示错误

java - Vaadin 小部件集编译失败