简体   繁体   English

带有VAADIN 8,Gradle和SpringBoot的画布插件

[英]Canvas addon with VAADIN 8, Gradle and SpringBoot

I am new to all Gradle, VAADIN and Spring, and am just working through a simple VAADIN Spring Boot tutorial ( https://spring.io/guides/gs/crud-with-vaadin/ ) and tried to add the Canvas add-on from https://github.com/hezamu/vaadincanvas , but when I add the compile dependency 我是所有Gradle,VAADIN和Spring的新手,并且只是通过一个简单的VAADIN Spring Boot教程( https://spring.io/guides/gs/crud-with-vaadin/ )进行工作,并尝试添加Canvas add-在https://github.com/hezamu/vaadincanvas上 ,但是当我添加编译依赖项时

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

a VAADIN widget compile will fail with tons of weird errors: 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

Just by removing that one dependency, the project builds. 只需删除一个依赖项,即可构建项目。 This is the entire Gradle build file: 这是整个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")
}

What am I doing wrong? 我究竟做错了什么? I am using Gradle 4.1 and Java 8. 我正在使用Gradle 4.1和Java 8。

There is a problem with your vaadin version. 您的vaadin版本存在问题。 You have a bom with 8.0.0 but I guess the gradle plugin tries to use a newer version (8.1.8). 您的Bom版本为8.0.0,但我猜gradle插件尝试使用更新的版本(8.1.8)。

With Vaadin 8.1 the drag&drop Handling changed. 使用Vaadin 8.1,拖放处理发生了变化。 I guess the addon doesn't support Vaadin 8.1 because it was released before. 我猜该插件不支持Vaadin 8.1,因为它是以前发布的。

You have three options. 您有三个选择。

  1. Use some other addon if possible. 如果可能,请使用其他一些插件。
  2. Fix the addon yourself 自己修复插件
  3. Or as a last resort add the following code to your build gradle to stay at Vaadin 8.0 或者作为最后的选择,将以下代码添加到构建包中以保留在Vaadin 8.0中

    vaadin { version '8.0.7' } vaadin {版本'8.0.7'}

Well, I got it to work after "fine-tuning" all versions. 好吧,在对所有版本进行“微调”之后,我就可以使用它。 VAADIN, its' addons and Gradle seem to be a fickle team. VAADIN,其插件和Gradle似乎是一个善变的团队。 It works with the spring-boot gradle plugin 1.4.7.RELEASE (important!), VAADIN 8.1.1, the devsoap VAADIN Gradle plugin 1.3.1, the multifileupload addon 3.0.1 and the canvas addon 2.2.0. 它与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一起使用。

Pretty much any change in any of these versions, and something falls apart. 这些版本中的任何更改几乎都没有,并且有些崩溃了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM