Vaadin 8 alpha/beta 预发布失败,出现“不可解析的导入 POM:找不到”错误

Vaadin 8 alpha/beta prerelease fail with “Non-resolvable import POM: Failure to find” errors

我无法试用 Vaadin 8 的 alpha 和 beta 版本。

➥ 我究竟需要做什么才能将工作中的 Vaadin 8.5.2 项目更改为使用 Vaadin 8.6.0beta1

场景

我正在使用 IntelliJ 2018.3,配置为使用外部 Maven 3.5.4。

我按照在以下位置看到的说明进行操作: https://vaadin.com/framework/releases/8.6.0.beta1

实际上,我的 POM 已经有一对 <id>vaadin-prereleases</id> 条目,如该页面所示:

<repositories>
         <!-- ... -->

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

</repositories>

<pluginRepositories>
         <!-- ... -->

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

</pluginRepositories>

问题

当我改变时:

<vaadin.version>8.5.2</vaadin.version>
<vaadin.plugin.version>8.5.2</vaadin.plugin.version>

至:

<vaadin.version>8.6.0beta1</vaadin.version>
<vaadin.plugin.version>8.6.0beta1</vaadin.plugin.version>

…当 运行 Maven clean 时,我得到以下错误,基本上是关于 Non-resolvable import POM: Failure to find com.vaadin:vaadin-bom:pom:8.6.0beta1

控制台:

[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:8.6.0beta1 in http://maven.vaadin.com/vaadin-addons was cached in the local repository, resolution will not be reattempted until the update interval of vaadin-addons has elapsed or updates are forced @ line 41, column 25
[ERROR] 'dependencies.dependency.version' for com.vaadin:vaadin-server:jar is missing. @ line 58, column 21
[ERROR] 'dependencies.dependency.version' for com.vaadin:vaadin-push:jar is missing. @ line 62, column 21
[ERROR] 'dependencies.dependency.version' for com.vaadin:vaadin-client-compiled:jar is missing. @ line 66, column 21
[ERROR] 'dependencies.dependency.version' for com.vaadin:vaadin-themes:jar is missing. @ line 70, column 21
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.basilbourque.example:grid-refresh:1.0-SNAPSHOT (/Users/basilbourque/IdeaProjects/GridRefresh/pom.xml) has 5 errors
[ERROR]     Non-resolvable import POM: Failure to find com.vaadin:vaadin-bom:pom:8.6.0beta1 in http://maven.vaadin.com/vaadin-addons was cached in the local repository, resolution will not be reattempted until the update interval of vaadin-addons has elapsed or updates are forced @ line 41, column 25 -> [Help 2]
[ERROR]     'dependencies.dependency.version' for com.vaadin:vaadin-server:jar is missing. @ line 58, column 21
[ERROR]     'dependencies.dependency.version' for com.vaadin:vaadin-push:jar is missing. @ line 62, column 21
[ERROR]     'dependencies.dependency.version' for com.vaadin:vaadin-client-compiled:jar is missing. @ line 66, column 21
[ERROR]     'dependencies.dependency.version' for com.vaadin:vaadin-themes:jar is missing. @ line 70, 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

将这两行更改为 8.5.08.5.1 等正式版本时,我没有遇到这些问题。问题仅出在 alpha 和 beta 预发行版上。

这是一个示例 POM 文件。

<?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.example</groupId>
    <artifactId>grid-refresh</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>grid-refresh</name>

    <prerequisites>
        <maven>3</maven>
    </prerequisites>

    <properties>
        <!-- Changing this… -->
        <!--<vaadin.version>8.5.2</vaadin.version>-->
        <!--<vaadin.plugin.version>8.5.2</vaadin.plugin.version>-->
        <!-- …to this… -->
        <vaadin.version>8.6.0beta1</vaadin.version>
        <vaadin.plugin.version>8.6.0beta1</vaadin.plugin.version>
        <!-- …fails with an error message:  Non-resolvable import POM: Failure to find com.vaadin:vaadin-bom:pom:8.6.0beta1 in http://maven.vaadin.com/vaadin-addons was cached in the local repository, resolution will not be reattempted until the update interval of vaadin-addons has elapsed or updates are forced @ line 41, column 25 -->
        <jetty.plugin.version>9.4.12.v20180830</jetty.plugin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>10</maven.compiler.source>
        <maven.compiler.target>10</maven.compiler.target>
        <!-- If there are no local customizations, this can also be "fetch" or "cdn" -->
        <vaadin.widgetset.mode>local</vaadin.widgetset.mode>
    </properties>

    <repositories>
        <repository>
            <id>vaadin-addons</id>
            <url>http://maven.vaadin.com/vaadin-addons</url>
        </repository>
    </repositories>

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

    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-server</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-push</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client-compiled</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-themes</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.2</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <!-- Exclude an unnecessary file generated by the GWT compiler. -->
                    <packagingExcludes>WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>update-theme</goal>
                            <goal>update-widgetset</goal>
                            <goal>compile</goal>
                            <!-- Comment out compile-theme goal to use on-the-fly theme compilation -->
                            <goal>compile-theme</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.1.0</version>
                <!-- Clean up also any pre-compiled themes -->
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/main/webapp/VAADIN/themes</directory>
                            <includes>
                                <include>**/styles.css</include>
                                <include>**/styles.scss.cache</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <!-- The Jetty plugin allows us to easily test the development build by
                running jetty:run on the command line. -->
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.plugin.version}</version>
                <configuration>
                    <scanIntervalSeconds>2</scanIntervalSeconds>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- Vaadin pre-release repositories -->
            <id>vaadin-prerelease</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>

            <repositories>
                <repository>
                    <id>vaadin-prereleases</id>
                    <name>Vaadin Pre-releases</name>
                    <url>http://maven.vaadin.com/vaadin-prereleases</url>
                </repository>
                <repository>
                    <id>vaadin-snapshots</id>
                    <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>vaadin-prereleases</id>
                    <name>Vaadin Pre-releases</name>
                    <url>http://maven.vaadin.com/vaadin-prereleases</url>
                </pluginRepository>
                <pluginRepository>
                    <id>vaadin-snapshots</id>
                    <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
                    <releases>
                        <enabled>false</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>

</project>

我尝试删除主文件夹中的 .m2 > repository 文件夹。没有帮助。

我看到两个问题:

  1. 版本字符串中缺少 .。它应该是 8.6.0.beta1 而不是 8.6.0beta1
  2. 预发布存储库仅为 vaadin-prerelease 配置文件配置,默认情况下未启用。您需要更改 pom.xml 以始终启用配置文件或在构建应用程序时手动启用它(例如从命令行使用 -Pvaadin-prerelease)。出于性能原因,默认情况下不启用配置文件。

查看 IntelliJ 2018 年的屏幕截图,显示:

  • 通过复选框启用的 vaadin-prerelease 配置文件。
  • POM 文件的 vaadin-version 元素中的有效值。