使用 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:validation-api"。 我相信这是导致问题的原因,但我找不到一种方法来强制vaadin-client使用"javax.validation:validation-api:1.0.0.GA"。

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

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

您看到错误的原因是,来自 Springboot 的javax.validation1.1 的 dep 覆盖了所有配置(也是用于为 Vaadin 构建客户端的配置(

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

相关内容

最新更新