Update a Vaadin 10 project to Vaadin 11 beta?

Pekka Hyvönen:
To me those steps are working fine - after I’ve edited the pom.xml, IntelliJ asks me to “reimport the maven project”, I click that (can also be done from the project view with right click → maven → reimport). Then I just trigger jetty:run from maven projects view → my-starter-project → plugings → jetty → jetty:run and it “just works”.

Indeed, the POM re-imports, the project builds, and the app runs in Jetty (or with Tomcat externally).

But look at <version>${vaadin.version}</version> in the profile at bottom of the POM. There I have ${vaadin.version} in red colored text (in the IntelliJ editor). Upon mouse-hover, we see error: Plugin 'com.vaadin:vaadin-maven-plugin:12.0.0.beta1' not found

I suspect this is a non-issue in development, as we are both running the project without using that defined production-mode profile.

See attached screenshot in next posting.

POM error screenshot attached.
17374103.jpg

Suddenly got it all working. Perhaps I fixed a boo-boo on my end, but actually I believe some Maven or Vaadin repositories got updated. Thanks for all the help in posts above.

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.

(1)

Refresh your local cache for Maven.

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

(2)

Change this:

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

… to this:

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

(3)

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)

Perform a Maven clean and install.

Verify that your POM reports no errors.

Here is a complete working 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.acme</groupId>
    <artifactId>acme</artifactId>
    <name>Acme</name>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <properties>
        <maven.compiler.source>10</maven.compiler.source>
        <maven.compiler.target>10</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>

17382947.jpg

Thanks for the post! I think the biggest gotcha there is that you need to update both the repositories and the pluginRepositories to use prereleases.

Now it is also possible to get the latest prerelease versions of every starter from https://vaadin.com/start/pre-release

Pekka Hyvönen:
Now it is also possible to get the latest prerelease versions of every starter from https://vaadin.com/start/pre-release

Not any longer.

https://vaadin.com/start/pre-release
…forwards to:
https://vaadin.com/start/latest

FYI, I have this issue asked and answered on Stack Overflow:

[Configure Maven pom to access Vaadin 14 alpha/beta pre-release]
(https://stackoverflow.com/q/57910701/642706)

Pekka Hyvönen:
Now it is also possible to get the latest prerelease versions of every starter from https://vaadin.com/start/pre-release

On that page I see Version 16 (Pre-release), but not [Vaadin 14.2.0.beta1]
(https://github.com/vaadin/platform/releases/tag/14.2.0.beta1).

So apparently, that page only lists future generations (first part of version number), but not previews of updates (second part of version numbers).