将基于Vaadin 11的Maven驱动项目改成Vaadin 12 alpha版本?
Change Maven-driven project based on Vaadin 11 to Vaadin 12 alpha version?
问题
我在 IntelliJ 2018.3 for Vaadin 11, created using the Project Base 启动包中有一个工作项目。
➥ 如何从 Vaadin 11.0.0 切换到 Vaadin 12.0.0.alpha4?
我的问题与此类似,该页面上的 . 是在 Profiles 列表中启用 vaadin-prerelease
复选框 Maven IntelliJ 的侧边栏。但是对于 Vaadin 11 项目,唯一一个这样的复选框被标记为 production-mode
.
失败的解决方案
在项目的Maven POM文件中,pom.xml
,我试过切换:
<vaadin.version>11.0.0</vaadin.version>
…至:
<vaadin.version>12.0.0.alpha4</vaadin.version>
...从 currently published JavaDoc site.
中获取版本号字符串
使用此版本号执行 Maven clean
时,出现以下错误:
[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 的入门包。
https://vaadin.com/start/pre-release
手动方式
我不知道以下解决方案是否合适,但它似乎有效。不幸的是,Vaadin 站点上没有记录解决方案,因此 I put in a request.
配置预发布 Maven 存储库
似乎 POM file built by the Project Base starter-pack lacks the necessary Maven 配置设置找到了 Vaadin 的 alpha/beta 预发布版本。
截至 2018 年 11 月 15 日,对于 Vaadin 12.0.0.beta2,在 Vaadin 入门包的页面上获取一个工作项目,例如从 "Project Base" 创建的项目,并进行以下更改。这在今天有效,但我有 much trouble over past weeks。我怀疑问题是某些 Maven 或 Vaadin 存储库未正确更新,并且缺少一些关键文件。无论如何,它今天有效。
首先,在 GitHub 上 vaadin/platform 的 Releases 页面找到最新的 alpha 或 beta 版本号。今天是 12.0.0.beta2
。
(1)
刷新 Maven 的本地缓存。
在 IntelliJ 2018 中,选择 Preferences
/Settings
> Build, Execution, Deployment
> Build Tools
> Maven
> Repositories
> Update
(按钮)。
(2)
在您项目的 POM 文件中,将此更改为:
<vaadin.version>11.0.2</vaadin.version>
… 对此:
<vaadin.version>12.0.0.beta2</vaadin.version>
(3)
在 repositories
元素内,添加:
<repository>
<id>vaadin-prereleases</id>
<url>https://maven.vaadin.com/vaadin-prereleases</url>
</repository>
(4)
在 repositories
元素下面,添加:
<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 clean
和 install
。
验证您的 POM 报告没有错误。
这是我从 上的 Project Base 改编而来的完整工作 POM入门包页面.
要查找我的 3 个更改,请搜索措辞: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>
问题
我在 IntelliJ 2018.3 for Vaadin 11, created using the Project Base 启动包中有一个工作项目。
➥ 如何从 Vaadin 11.0.0 切换到 Vaadin 12.0.0.alpha4?
我的问题与此类似,该页面上的 vaadin-prerelease
复选框 Maven IntelliJ 的侧边栏。但是对于 Vaadin 11 项目,唯一一个这样的复选框被标记为 production-mode
.
失败的解决方案
在项目的Maven POM文件中,pom.xml
,我试过切换:
<vaadin.version>11.0.0</vaadin.version>
…至:
<vaadin.version>12.0.0.alpha4</vaadin.version>
...从 currently published JavaDoc site.
中获取版本号字符串使用此版本号执行 Maven clean
时,出现以下错误:
[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 的入门包。
https://vaadin.com/start/pre-release
手动方式
我不知道以下解决方案是否合适,但它似乎有效。不幸的是,Vaadin 站点上没有记录解决方案,因此 I put in a request.
配置预发布 Maven 存储库
似乎 POM file built by the Project Base starter-pack lacks the necessary Maven 配置设置找到了 Vaadin 的 alpha/beta 预发布版本。
截至 2018 年 11 月 15 日,对于 Vaadin 12.0.0.beta2,在 Vaadin 入门包的页面上获取一个工作项目,例如从 "Project Base" 创建的项目,并进行以下更改。这在今天有效,但我有 much trouble over past weeks。我怀疑问题是某些 Maven 或 Vaadin 存储库未正确更新,并且缺少一些关键文件。无论如何,它今天有效。
首先,在 GitHub 上 vaadin/platform 的 Releases 页面找到最新的 alpha 或 beta 版本号。今天是 12.0.0.beta2
。
(1)
刷新 Maven 的本地缓存。
在 IntelliJ 2018 中,选择 Preferences
/Settings
> Build, Execution, Deployment
> Build Tools
> Maven
> Repositories
> Update
(按钮)。
(2)
在您项目的 POM 文件中,将此更改为:
<vaadin.version>11.0.2</vaadin.version>
… 对此:
<vaadin.version>12.0.0.beta2</vaadin.version>
(3)
在 repositories
元素内,添加:
<repository>
<id>vaadin-prereleases</id>
<url>https://maven.vaadin.com/vaadin-prereleases</url>
</repository>
(4)
在 repositories
元素下面,添加:
<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 clean
和 install
。
验证您的 POM 报告没有错误。
这是我从 上的 Project Base 改编而来的完整工作 POM入门包页面.
要查找我的 3 个更改,请搜索措辞: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>