使用Gradle Vaadin插件时出错

问题描述:

我想将Gradle Vaadin插件添加到我的项目中,但出现以下错误。使用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:验证-API”。 我认为这是造成这个问题,但我找不到一种方法来强制vaadin-client使用“javax.validation:validation-api:1.0.0.GA”。

我很感激,如果你能帮我纠正build.gradle。

Gradle Vaadin插件必须看到Springboot插件才能正确设置。所以你必须先使用Springboot插件,然后再使用Vaadin插件。

的理由让你看到的错误是,在DEP对于javax.validation 1.1 Springboot覆盖所有配置(也用于构建Vaadin客户端的一个)

在一个侧面说明:在应用Springboot插件两次 - 一次在plugins,一次以apply。我会摆脱buildscript -block和apply。然后交换plugins中的项目。