本文介绍了将基于Vaadin 11的Maven驱动的项目更改为Vaadin 12 alpha版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 IntelliJ 2018.3中有一个正在工作的项目,用于 Vaadin 11,使用 项目基础 入门包.

I have a working project in IntelliJ 2018.3 for Vaadin 11, created using the Project Base starter-pack.

➥如何从 Vaadin 11.0.0 切换到 Vaadin 12.0.0.alpha4 ?

我在这里的问题与此类似, Vaadin 8 alpha/beta预发行失败,并显示不可解析的导入POM:找不到错误" .该页面上的解决方案是在IntelliJ的 Maven 侧边栏.但是对于Vaadin 11项目,唯一找到的此类复选框标记为production-mode.

My Question here is similar to this one, Vaadin 8 alpha/beta prerelease fail with "Non-resolvable import POM: Failure to find" errors. The solution on that page was to enable a vaadin-prerelease checkbox in the Profiles list in the Maven sidebar of IntelliJ. But with a Vaadin 11 project, the only such checkbox found there is labeled production-mode.

在项目的Maven POM文件pom.xml中,我尝试切换:

In the project’s Maven POM file, pom.xml, I tried switching:

<vaadin.version>11.0.0</vaadin.version>

…至:

<vaadin.version>12.0.0.alpha4</vaadin.version>

…已从当前发布的版本号字符串中提取JavaDoc网站.

使用该版本号执行Maven clean时,出现以下错误:

When executing a Maven clean with this version number in place, I get these errors:

[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Non-resolvable import POM: Failure to find com.vaadin:vaadin-bom:pom:12.0.0.alpha4 in http://maven.vaadin.com/vaadin-addons was cached in the local repository, resolution will not be reattempted until the update interval of Vaadin Directory has elapsed or updates are forced @ line 28, column 25
[ERROR] 'dependencies.dependency.version' for com.vaadin:vaadin-core:jar is missing. @ line 39, column 21
[ERROR] 'dependencies.dependency.version' for org.slf4j:slf4j-simple:jar is missing. @ line 46, column 21
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project com.basilbourque.acme:acme:1.0-SNAPSHOT (/Users/basilbourque/IdeaProjects/Acme/pom.xml) has 3 errors
[ERROR]     Non-resolvable import POM: Failure to find com.vaadin:vaadin-bom:pom:12.0.0.alpha4 in http://maven.vaadin.com/vaadin-addons was cached in the local repository, resolution will not be reattempted until the update interval of Vaadin Directory has elapsed or updates are forced @ line 28, column 25 -> [Help 2]
[ERROR]     'dependencies.dependency.version' for com.vaadin:vaadin-core:jar is missing. @ line 39, column 21
[ERROR]     'dependencies.dependency.version' for org.slf4j:slf4j-simple:jar is missing. @ line 46, column 21
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

推荐答案

简单方法

Vaadin Ltd现在使此操作变得更加容易.他们在页面上添加了一个标签,其中列出了预配置为使用最新预发布版本的POM的入门包.

The easy way

Vaadin Ltd now makes this easier. They added a tab on the page listing starter-packs for a POM pre-configured to use the latest pre-release.

https://vaadin.com/start/pre-release

不知道以下解决方案是否正确,但似乎可行.不幸的是,Vaadin网站上没有记录解决方案,因此我提出了要求.

I do not know if the following solution is proper, but it seems to be working. Unfortunately a solution is not documented on the Vaadin site, so I put in a request.

似乎是 Project Base构建的 POM 文件 em> starter-pack缺少必要的 Maven 配置设置,无法找到预发布的alpha/beta版本Vaadin的版本.

It seems the POM file built by the Project Base starter-pack lacks the necessary Maven configuration settings to find the alpha/beta pre-release versions of Vaadin.

自2018年11月15日起,对于Vaadin 12.0.0.beta2,采用一个工作项目,例如从Vaadin初学者包装的项目库"中创建的一个项目,并进行以下更改.今天可以使用,但是我有过去几周有很多麻烦.我怀疑问题是某些Maven或Vaadin信息库未正确更新,并且缺少一些关键文件.无论如何,它在今天仍然有效.

As of 2018-11-15, for Vaadin 12.0.0.beta2, take a working project such as one created from "Project Base" on the Vaadin pago of starter-packs, and make the following changes. This works today, but I have had much trouble over past weeks. I suspect the problem was that some Maven or Vaadin repositories were not updated properly, and were missing some key file(s). At any rate, it works today.

首先,在 发布 页面上GitHub上的 vaadin/platform .今天是12.0.0.beta2.

First, find the latest alpha or beta version number at the Releases page for vaadin/platform on GitHub. Today that is 12.0.0.beta2.

(1)

为Maven刷新本地缓存.

Refresh your local cache for Maven.

在IntelliJ 2018中,选择Preferences/Settings> Build, Execution, Deployment> Build Tools> Maven> Repositories> Update(按钮).

In IntelliJ 2018, choose Preferences/Settings > Build, Execution, Deployment > Build Tools > Maven > Repositories > Update (button).

(2)

在项目的POM文件中,更改以下内容:

In the POM file of your project, change this:

<vaadin.version>11.0.2</vaadin.version>

…对此:

 <vaadin.version>12.0.0.beta2</vaadin.version>

(3)

内部中的repositories元素中,添加以下内容:

Inside the repositories element, add this:

    <repository>
        <id>vaadin-prereleases</id>
        <url>https://maven.vaadin.com/vaadin-prereleases</url>
    </repository>

(4)

在元素下方,添加以下内容:

Below the repositories element, add this:

<pluginRepositories>
    <!-- Repository needed for prerelease versions of Vaadin -->
    <pluginRepository>
        <id>vaadin-prereleases</id>
        <url>https://maven.vaadin.com/vaadin-prereleases</url>
    </pluginRepository>
</pluginRepositories>

(5)

执行Maven cleaninstall.

Perform a Maven clean and install.

验证您的 POM 没有报告错误.

Verify that your POM reports no errors.

这是我从 POM 的完整作品.在 项目库 .com/start/latest"rel =" nofollow noreferrer>入门包页面.

Here is a complete working POM that I adapted from the Project Base found on the page of starter-packs.

要找到我的3个更改,请搜索措词:alphas-betas

To find my 3 changes, search for the phrasing: alphas-betas

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns = "http://maven.apache.org/POM/4.0.0"
         xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation = "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.basilbourque.acme</groupId>
    <artifactId>acme</artifactId>
    <name>Acme</name>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <failOnMissingWebXml>false</failOnMissingWebXml>

        <!--<vaadin.version>11.0.2</vaadin.version>-->
        <!--Change above line to line below for alphas-betas-->
        <vaadin.version>12.0.0.beta2</vaadin.version>
    </properties>

    <repositories>
        <!-- Repository used by many Vaadin add-ons -->
        <repository>
            <id>Vaadin Directory</id>
            <url>http://maven.vaadin.com/vaadin-addons</url>
        </repository>

        <!--Add this for alphas-betas-->
        <repository>
            <id>vaadin-prereleases</id>
            <url>https://maven.vaadin.com/vaadin-prereleases</url>
        </repository>

    </repositories>

    <!--Add this for alphas-betas-->
    <pluginRepositories>
        <!-- Repository needed for prerelease versions of Vaadin -->
        <pluginRepository>
            <id>vaadin-prereleases</id>
            <url>https://maven.vaadin.com/vaadin-prereleases</url>
        </pluginRepository>
    </pluginRepositories>

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

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-core</artifactId>
        </dependency>

        <!-- Added to provide logging output as Flow uses -->
        <!-- the unbound SLF4J no-operation (NOP) logger implementation -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Jetty plugin for easy testing without a server -->
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.4.11.v20180605</version>
                <configuration>
                    <scanIntervalSeconds>1</scanIntervalSeconds>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- Production mode can be activated with either property or profile -->
            <id>production-mode</id>
            <activation>
                <property>
                    <name>vaadin.productionMode</name>
                </property>
            </activation>
            <properties>
                <vaadin.productionMode>true</vaadin.productionMode>
            </properties>

            <dependencies>
                <dependency>
                    <groupId>com.vaadin</groupId>
                    <artifactId>flow-server-production-mode</artifactId>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-maven-plugin</artifactId>
                        <version>${vaadin.version}</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>copy-production-files</goal>
                                    <goal>package-for-production</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

这篇关于将基于Vaadin 11的Maven驱动的项目更改为Vaadin 12 alpha版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-21 18:31