如何配置 Vaadin 项目以使用 Vaadin-spring-boot-starter 和最新的 Vaadin 框架

How to configure Vaadin project to use Vaadin-spring-boot-starter with latest Vaadin framework

我已经根据最新的 Vaadin Spring 引导启动器版本 2.0.1 定义了我的项目,如下所示。 我想使用最新的 Vaadin 框架版本 8.1.0.rc2(今天发布)来使用树和新的拖放功能。是否可以保留 spring 引导版本但在 Maven 中使用新的 Vaadin 功能?

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.3.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <vaadin.version>8.1.0.rc2</vaadin.version>
</properties>

<dependencies>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-spring-boot-starter</artifactId>
        <version>2.0.1</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.gdl2</groupId>
        <artifactId>gdl2</artifactId>
        <version>0.3.20</version>
    </dependency>

    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>19.0</version>
    </dependency>

    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.2.3</version>
    </dependency>

    <dependency>
        <groupId>org.openehr.adl2-core</groupId>
        <artifactId>adl-parser</artifactId>
        <version>1.3.8</version>
    </dependency>

</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-bom</artifactId>
            <version>${vaadin.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

问题是我应该更改存储库,因为我想使用预发布版本。为此,应将以下行添加到 pom 文件中的存储库:

<pluginRepositories>
    <pluginRepository>
        <id>vaadin-prereleases</id>
        <name>Vaadin Pre-releases</name>
        <url>https://maven.vaadin.com/vaadin-prereleases</url>
    </pluginRepository>

</pluginRepositories>
<repositories>
    <repository>
        <id>vaadin-prereleases</id>
        <name>Vaadin Pre-releases</name>
        <url>https://maven.vaadin.com/vaadin-prereleases</url>
    </repository>
    <repository>
        <id>vaadin-addons</id>
        <url>http://maven.vaadin.com/vaadin-addons</url>
    </repository>
</repositories>

除此之外,应添加以下依赖项:

<!-- ===============================Spring dependency======================================= -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>

<!-- ============================Vaadin dependencies=============================== -->
<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-spring-boot-starter</artifactId>
    <version>2.0.1</version>
</dependency>
<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-themes</artifactId>
    <version>${vaadin.version}</version>
</dependency>
<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-client-compiled</artifactId>
    <version>${vaadin.version}</version>
</dependency>

最后一件事是版本 属性:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <vaadin.version>8.1.0.rc2</vaadin.version>
</properties>