Canvas插件包含VAADIN 8,Gradle和SpringBoot

时间:2018-02-18 15:10:49

标签: java canvas gradle widget vaadin

我是所有Gradle,VAADIN和Spring的新手,我正在通过一个简单的VAADIN Spring Boot教程(https://spring.io/guides/gs/crud-with-vaadin/)并试图从https://github.com/hezamu/vaadincanvas添加Canvas插件,但是当我添加了编译依赖

compile("org.vaadin.hezamu:canvas:2.3.0")

VAADIN小部件编译将失败并出现大量奇怪的错误:

Using Gradle Vaadin Plugin 1.3.1
:vaadinPluginVersionCheck SKIPPED
:compileJava UP-TO-DATE
:vaadinUpdateWidgetset
:processResources UP-TO-DATE
:classes UP-TO-DATE
:vaadinClassPathJar UP-TO-DATE
Errors in 'jar:file:/C:/Users/msc/.gradle/caches/modules-2/files-2.1/com.vaadin/vaadin-client/8.1.8/93548adad170aea9fe62ab742908fe63fe0ec321/vaadin-client-8.1.8.jar!/com/vaadin/client/extensions/DragSourceExtensionConnector.java'
Line 413: The method getState() from the type DragSourceExtensionConnector refers to the missing type DragSourceState
Line 38: The import com.vaadin.shared.ui.dnd cannot be resolved
Line 433: DragSourceRpc cannot be resolved to a type
Line 605: DragSourceState cannot be resolved to a type
Line 39: The import com.vaadin.shared.ui.dnd cannot be resolved
Line 507: DragSourceRpc cannot be resolved to a type
Line 190: The method getState() from the type DragSourceExtensionConnector refers to the missing type DragSourceState
Line 433: The method getRpcProxy(Class<T>) in the type AbstractConnector is not applicable for the arguments (Class<DragSourceRpc>)
Line 212: DragSourceState cannot be resolved to a variable
Line 492: DropEffect cannot be resolved
Line 606: DragSourceState cannot be resolved to a type

只需删除那个依赖项,项目即可构建。这是整个Gradle构建文件:

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.10.RELEASE")
        classpath "com.devsoap.plugin:gradle-vaadin-plugin:1.3.1"
        classpath "javax.validation:validation-api:1.1.0.Final"
    }
}

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

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'com.devsoap.plugin.vaadin'

jar {
    baseName = 'gs-crud-with-vaadin'
    version =  '0.1.0'
}

repositories {
    mavenCentral()
    maven { url "https://oss.sonatype.org/content/repositories/vaadin-snapshots" }
    maven { url "https://repository.jboss.org/nexus/content/repositories/releases" }
    maven { url "http://oss.sonatype.org/content/repositories/vaadin-snapshots/" }
    maven { url "http://vaadin.com/nexus/content/repositories/vaadin-addons/" }
    maven { url "https://plugins.gradle.org/m2/" }
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencyManagement {
  imports {
    mavenBom 'com.vaadin:vaadin-bom:8.0.0'
  }
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter-data-jpa")
    compile("com.vaadin:vaadin-spring-boot-starter")
    compile("org.springframework.boot:spring-boot-starter-actuator")
    compile("org.vaadin.hezamu:canvas:2.3.0")
    compile("com.h2database:h2")
    testCompile("junit:junit")
    testCompile("org.springframework.boot:spring-boot-starter-test")
}

我做错了什么?我正在使用Gradle 4.1和Java 8。

2 个答案:

答案 0 :(得分:0)

您的vaadin版本存在问题。你有一个8.0.0的bom,但我想gradle插件试图使用更新的版本(8.1.8)。

使用Vaadin 8.1,拖放操作发生了变化。我想插件并不支持Vaadin 8.1,因为它之前已经发布过。

您有三种选择。

  1. 如果可能,请使用其他插件。
  2. 自行修复插件
  3. 或者作为最后的手段,将以下代码添加到构建gradle以留在Vaadin 8.0

    vaadin {     版本&#39; 8.0.7&#39; }

答案 1 :(得分:0)

嗯,我在“微调”所有版本之后开始工作了。 VAADIN,它的'插件和Gradle似乎是一个善变的团队。它适用于spring-boot gradle插件1.4.7.RELEASE(重要!),VAADIN 8.1.1,devsoap VAADIN Gradle插件1.3.1,multifileupload插件3.0.1和canvas插件2.2.0。

这些版本中的任何一个版本都有任何变化,而且有些分崩离析。