Vaadin Spring war file not loading to TomCat - spring-boot

I have been working on my application for quite a while without building a war file. About 4 months ago, built the war, my Tomcat server picked it up just fine.
I've since moved to Java 17, Spring 2.7.8 and from Vaadin 22 to Vaadin 23.3.6. So, last week was the week to go to production. Having done this many times, was not expecting any issues. Silly me.
Finally got so frustrated I downloaded the simplest app from https://vaadin.com/hello-world-starters, "Vaadin 23 - Spring Boot". This compiled to a jar and works just fine.
I followed this list of steps to get a war file built:
Changed from jar to war packaging in the pom
Added the spring-boot-starter-tomcat dependency with provided
Build using mvn clean package -Pproduction and it built without errors.
Moved the .war to the Tomcat webapps directory.
from the localhost log:
16-Feb-2023 17:15:00.211 INFO [main] org.apache.catalina.core.ApplicationContext.log Initializing AtmosphereFramework
16-Feb-2023 17:15:00.265 INFO [main] org.apache.catalina.core.ApplicationContext.log 1 Spring WebApplicationInitializers detected on classpath
16-Feb-2023 17:15:00.278 SEVERE [main] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [com.vaadin.flow.server.startup.ServletContextListeners]
java.lang.IllegalStateException: The application Lookup instance is not found in VaadinContext. The instance is suppoed to be created by a ServletContainerInitializer. Issues known to cause this problem are:
- A Spring Boot application deployed as a war-file but the main application class does not extend SpringBootServletInitializer
- An embedded server that is not set up to execute ServletContainerInitializers
- Unit tests which do not properly set up the context for the test
at com.vaadin.flow.server.startup.ApplicationConfiguration.lambda$get$0(ApplicationConfiguration.java:54)
at com.vaadin.flow.server.VaadinServletContext.getAttribute(VaadinServletContext.java:73)
at com.vaadin.flow.server.startup.ApplicationConfiguration.get(ApplicationConfiguration.java:48)
at com.vaadin.flow.server.DeploymentConfigurationFactory.createPropertyDeploymentConfiguration(DeploymentConfigurationFactory.java:82)
at com.vaadin.flow.server.startup.ServletDeployer$StubServletConfig.createDeploymentConfiguration(ServletDeployer.java:185)
at com.vaadin.flow.server.startup.ServletDeployer.lambda$getServletConfigurations$0(ServletDeployer.java:280)
at java.base/java.util.Optional.ifPresent(Optional.java:183)
at com.vaadin.flow.server.startup.ServletDeployer.getServletConfigurations(ServletDeployer.java:279)
at com.vaadin.flow.server.startup.ServletDeployer.contextInitialized(ServletDeployer.java:194)
at com.vaadin.flow.server.startup.ServletContextListeners.contextInitialized(ServletContextListeners.java:44)
..... bunches more ......
16-Feb-2023 17:15:00.288 SEVERE [main] org.apache.catalina.core.StandardContext.listenerStop Exception sending context destroyed event to listener instance of class [com.vaadin.base.devserver.startup.DevModeStartupListener]
java.lang.NullPointerException
at com.vaadin.base.devserver.startup.DevModeStartupListener.contextDestroyed(DevModeStartupListener.java:89)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4817)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5478)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:187)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:698)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:696)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1024)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1911)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.
........... and more ...........
Spelunking the web, tried a bunch of other things like adding a dependency for spring-boot-starter-web. No joy.
Here is the 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>
<!-- Project from https://start.vaadin.com/project/d1a77315-5545-41f3-9d35-e61444d0cfb9 -->
<groupId>com.example.application</groupId>
<artifactId>myapp</artifactId>
<name>myapp</name>
<version>1</version>
<packaging>war</packaging>
<properties>
<java.version>17</java.version>
<vaadin.version>23.3.6</vaadin.version>
<!-- this parameter is needed as spring-boot bom overwrites it -->
<selenium.version>4.5.3</selenium.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.8</version>
</parent>
<repositories>
<!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->
<!-- Main Maven repository -->
<repository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>vaadin-prereleases</id>
<url>
https://maven.vaadin.com/vaadin-prereleases/
</url>
</repository>
<!-- Repository used by many Vaadin add-ons -->
<repository>
<id>Vaadin Directory</id>
<url>https://maven.vaadin.com/vaadin-addons</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->
<pluginRepository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<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>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>2.7.8</version>
<scope>provided</scope>
</dependency>
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>-->
<!-- -->
<dependency>
<groupId>com.vaadin</groupId>
<!-- Replace artifactId with vaadin-core to use only free components -->
<artifactId>vaadin</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-testbench</artifactId>
<scope>test</scope>
</dependency>
<!-- Include JUnit 4 support for TestBench and others -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.1.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>spring-boot:run</defaultGoal>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- Clean build and startup time for Vaadin apps sometimes may exceed
the default Spring Boot's 30sec timeout. -->
<configuration>
<jvmArguments>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5321</jvmArguments>
<wait>500</wait>
<maxAttempts>240</maxAttempts>
</configuration>
</plugin>
<!--
Take care of synchronizing java dependencies and imports in
package.json and main.js files.
It also creates webpack.config.js if not exists yet.
-->
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-frontend</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- Production mode is activated using -Pproduction -->
<id>production</id>
<build>
<plugins>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<executions>
<execution>
<goals>
<goal>build-frontend</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
<configuration>
<productionMode>true</productionMode>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>it</id>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>start-spring-boot</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-spring-boot</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Runs the integration tests (*IT) after the server is started -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<trimStackTrace>false</trimStackTrace>
<enableAssertions>true</enableAssertions>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Using Tomcat Tomcat/9.0.68, confirmed it is java 17 with "java -cp catalina.jar org.apache.catalina.util.ServerInfo"

Related

maven-install-plugin does not load local dependency

I'm trying load local dependencies using the Maven maven-install-plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<executions>
<execution>
<id>tetramap</id>
<phase>initialize</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>tetramap</groupId>
<artifactId>tetramap</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<file>${project.basedir}/lib/tetraMap-1.0.jar</file>
</configuration>
</execution>
</executions>
</plugin>
<dependency>
<groupId>tetramap</groupId>
<artifactId>tetraMap</artifactId>
<version>1.0</version>
</dependency>
As a result, the downloaded dependency should appear in the repository (user/.m2/repository). the files should appear in the repository. But they are not uploaded to the repository ("tetramap-1.0.jar " and "tetramap-1.0.pom" files and the "maven-metadata-local.xm" file is missing).
Please tell me what I'm doing wrong. I want to see the uploaded files in the repository tetramap-1.0.jar , tetramap-1.0.pom and maven-metadata-local.xml.
More detailed:
I need this in order to create a Docker image for a project with Vaadin and Spring.
My Dockerfile:
FROM openjdk:11-jdk-slim
COPY *.tetra ./
COPY src src
COPY frontend frontend
COPY route route
COPY package.json ./
COPY target/*.jar tetraweb.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/tetraweb.jar"]
If there are no such files in the user/.m2/repository directory, then when I run the command (creates a Docker image):
sudo docker build . -t tetraweb:latest
And then I run the image in the container
sudo docker run -p 8080:8080 tetraweb:latest
And after that I get an error:
java.lang.NoClassDefFoundError:
And if the files are located in the repository (user/.m2/repository) directory, then the Docker image is created correctly with local dependencies.
I tried connecting local dependencies in other ways:
<dependency>
<groupId>tetramap</groupId>
<artifactId>tetraMap</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/tetraMap-1.0.jar</systemPath>
</dependency>
или
<repository>
<id>local-repository</id>
<url>file://${project.basedir}/lib</url>
</repository>
...
<dependency>
<groupId>tetramap</groupId>
<artifactId>tetraMap</artifactId>
<version>1.0</version>
</dependency>
but the result is the same everywhere:
java.lang.NoClassDefFoundError
I found a temporary solution
my pom.xml:
<dependencies>
<dependency>
<groupId>tetramap</groupId>
<artifactId>tetraMap</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/tetraMap-1.0.jar</systemPath>
</dependency>
</dependencies>
...
<build>
<defaultGoal>spring-boot:run</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>inst_1</id>
<phase>initialize</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>tetramap</groupId>
<artifactId>tetraMap</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<file>${project.basedir}/lib/tetraMap-1.0.jar</file>
<localRepositoryPath>/home/user/.m2/repository</localRepositoryPath>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Now if I run a
mvn clean install
My directories in the repository are filled in correctly. I see the downloaded files:
enter image description here
At the moment, there is still a problem with creating a Docker image. If I run the command:
mvn -Pproduction
I see error:
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:23.2.7:build-frontend (default) on project tetraweb: Could not execute build-frontend goal: Error occured during goal execution: nullPlease run Maven with the -e switch (or Gradle with the --stacktrace switch), to learn the full stack trace. NullPointerException -> [Help 1]
[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/MojoFailureException
But if I disable the following code:
<!-- <scope>system</scope>
<systemPath>${project.basedir}/lib/tetraMap-1.0.jar</systemPath>-->
and I will run the command again:
mvn -Pproduction
In this case, the image creation will be successful
To upload a jar file to the repository, I need the included code:
<scope>system</scope>
<systemPath>${project.basedir}/lib/tetraMap-1.0.jar</systemPath>
To create a Docker image, this code must be disabled:( That's very strange...
This is my pom.xml all code:
<?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>
<!-- Project from https://start.vaadin.com/project/553cf24a-aade-4a91-a94d-9f2293333d44 -->
<groupId>oniip.tetra.web</groupId>
<artifactId>tetraweb</artifactId>
<name>tetraweb</name>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<java.version>11</java.version>
<vaadin.version>23.2.7</vaadin.version>
<!-- this parameter is needed as spring-boot bom overwrites it -->
<selenium.version>4.5.3</selenium.version>
<!-- selenium is so much verbose -->
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
</parent>
<repositories>
<!-- Main Maven repository -->
<repository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>vaadin-prereleases</id>
<url>
https://maven.vaadin.com/vaadin-prereleases/
</url>
</repository>
<!-- Repository used by many Vaadin add-ons -->
<repository>
<id>Vaadin Directory</id>
<url>https://maven.vaadin.com/vaadin-addons</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<!-- The order of definitions matters. Explicitly defining central here to make sure it has the highest priority. -->
<pluginRepository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<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>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<!-- Replace artifactId with vaadin-core to use only free components -->
<artifactId>vaadin</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-testbench</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.mysql/mysql-connector-j -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.0.31</version>
</dependency>
<!-- Include JUnit 4 support for TestBench and others -->
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.1.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.appreciated/apexcharts -->
<dependency>
<groupId>com.github.appreciated</groupId>
<artifactId>apexcharts</artifactId>
<version>23.0.0</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_2.11</artifactId>
<version>2.4.20</version>
</dependency>
<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-remote_2.11</artifactId>
<version>2.4.20</version>
</dependency>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
</dependency>
<dependency>
<groupId>com.github.oshi</groupId>
<artifactId>oshi-core</artifactId>
<version>5.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.simplejavamail/simple-java-mail -->
<dependency>
<groupId>org.simplejavamail</groupId>
<artifactId>simple-java-mail</artifactId>
<version>5.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>com.github.bbottema</groupId>
<artifactId>emailaddress-rfc2822</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.1</version>
</dependency>
<!-- Локальные репозитории -->
<dependency>
<groupId>org.jlibrtp</groupId>
<artifactId>jlibrtp</artifactId>
<version>1.0</version>
<!-- <scope>system</scope>
<systemPath>${project.basedir}/lib/jlibrtp.jar</systemPath>-->
</dependency>
<dependency>
<groupId>org.snmp4j</groupId>
<artifactId>snmp4j</artifactId>
<version>1.11.3</version>
<!-- <scope>system</scope>
<systemPath>${project.basedir}/lib/snmp4j-1.11.3.jar</systemPath>-->
</dependency>
<dependency>
<groupId>tetra.commons</groupId>
<artifactId>tetraCommons</artifactId>
<version>1.0</version>
<!-- <scope>system</scope>
<systemPath>${project.basedir}/lib/TetraCommons-1.0.jar</systemPath>-->
</dependency>
<dependency>
<groupId>tetramap</groupId>
<artifactId>tetraMap</artifactId>
<version>1.0</version>
<!-- <scope>system</scope>
<systemPath>${project.basedir}/lib/tetraMap-1.0.jar</systemPath>-->
</dependency>
</dependencies>
<build>
<defaultGoal>spring-boot:run</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>inst_1</id>
<phase>initialize</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>org.jlibrtp</groupId>
<artifactId>jlibrtp</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<file>${project.basedir}/lib/jlibrtp.jar</file>
<localRepositoryPath>/home/user/.m2/repository</localRepositoryPath>
</configuration>
</execution>
<execution>
<id>inst_2</id>
<phase>initialize</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>org.snmp4j</groupId>
<artifactId>snmp4j</artifactId>
<version>1.11.3</version>
<packaging>jar</packaging>
<file>${project.basedir}/lib/snmp4j-1.11.3.jar</file>
<localRepositoryPath>/home/user/.m2/repository</localRepositoryPath>
</configuration>
</execution>
<execution>
<id>inst_3</id>
<phase>initialize</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>tetra.commons</groupId>
<artifactId>tetraCommons</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<file>${project.basedir}/lib/TetraCommons-1.0.jar</file>
<localRepositoryPath>/home/user/.m2/repository</localRepositoryPath>
</configuration>
</execution>
<execution>
<id>inst_4</id>
<phase>initialize</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>tetramap</groupId>
<artifactId>tetraMap</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<file>${project.basedir}/lib/tetraMap-1.0.jar</file>
<localRepositoryPath>/home/user/.m2/repository</localRepositoryPath>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<!-- Clean build and startup time for Vaadin apps sometimes may exceed
the default Spring Boot's 30sec timeout. -->
<configuration>
<jvmArguments>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5037</jvmArguments>
<wait>500</wait>
<maxAttempts>240</maxAttempts>
</configuration>
</plugin>
<!--
Take care of synchronizing java dependencies and imports in
package.json and main.js files.
It also creates webpack.config.js if not exists yet.
-->
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-frontend</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- Production mode is activated using -Pproduction -->
<id>production</id>
<properties>
<vaadin.productionMode>true</vaadin.productionMode>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<executions>
<execution>
<goals>
<goal>build-frontend</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>it</id>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>start-spring-boot</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-spring-boot</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Runs the integration tests (*IT) after the server is started -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<trimStackTrace>false</trimStackTrace>
<enableAssertions>true</enableAssertions>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

Building a spring boot azure function with pipeline fails with following error: Failed to get Azure Functions Core Tools version locally

I am relatively new to azure functions and I am trying to create an azure function in java using spring boot that is triggered by an azure event hub message.
I used an example I found here and changed the relevant code from HTTP trigger to event hub trigger.
Building it locally and deploying it to azure via the maven plugin works without any issues but soon as I try to have this code built by an azure pipeline I get the following error:
[INFO] Step 8 of 8: Installing function extensions if needed
[WARNING] Failed to get Azure Functions Core Tools version locally
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:17 min
[INFO] Finished at: 2022-06-25T13:39:48Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.microsoft.***:***-functions-maven-plugin:1.14.2:package (package-functions) on project cutcloud-token-service: Local Azure Functions Core Tools does not exist or is too old to support function extension installation, skip package phase. To install or update it, see: https://aka.ms/azfunc-install -> [Help 1]
[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/MojoExecutionException
The process '/usr/bin/mvn' failed with exit code 1
my pipeline code:
trigger:
branches:
include:
- master
stages:
- stage: Build
jobs:
- job: Build
steps:
- task: MavenAuthenticate#0
inputs:
mavenServiceConnections: 'nexus'
- task: Maven#3
inputs:
mavenPomFile: 'pom.xml'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
javaHomeOption: 'JDKVersion'
jdkVersionOption: 11
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false
goals: clean package
and here is the pom.xml mostly like in the example with some additional libraries needed by my business logic:
<?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.example</groupId>
<artifactId>hello</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Hello Spring Function on Azure</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<azure.functions.java.library.version>2.0.0</azure.functions.java.library.version>
<azure.functions.maven.plugin.version>1.17.0</azure.functions.maven.plugin.version>
<!-- customize those two properties. The functionAppName should be unique across Azure -->
<functionResourceGroup>my-spring-function-resource-group</functionResourceGroup>
<functionAppName>my-spring-function</functionAppName>
<functionAppRegion>westeurope</functionAppRegion>
<stagingDirectory>${project.build.directory}/azure-functions/${functionAppName}</stagingDirectory>
<start-class>com.example.DemoApplication</start-class>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-adapter-azure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-function-webflux</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>com.microsoft.azure.sdk.iot</groupId>
<artifactId>iot-service-client</artifactId>
<version>1.33.2</version>
</dependency>
<dependency>
<groupId>de.digital.asap.cloud</groupId>
<artifactId>cloud-messages</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>net.gsadev.crypto</groupId>
<artifactId>crypto-lib</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.gatling.highcharts</groupId>
<artifactId>gatling-charts-highcharts</artifactId>
<version>3.7.6</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-dependencies</artifactId>
<version>3.2.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure.functions</groupId>
<artifactId>azure-functions-java-library</artifactId>
<version>${azure.functions.java.library.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<version>${azure.functions.maven.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>4.1.5</version>
<configuration>
<includes>
<include>com.example.loadtest.*</include>
</includes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<configuration>
<resourceGroup>${functionResourceGroup}</resourceGroup>
<appName>${functionAppName}</appName>
<region>${functionAppRegion}</region>
<runtime>
<os>linux</os>
<javaVersion>11</javaVersion>
</runtime>
<appSettings>
<!-- Run Azure Function from package file by default -->
<property>
<name>FUNCTIONS_EXTENSION_VERSION</name>
<value>~4</value>
</property>
<property>
<name>FUNCTIONS_WORKER_RUNTIME</name>
<value>java</value>
</property>
</appSettings>
</configuration>
<executions>
<execution>
<id>package-functions</id>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<overwrite>true</overwrite>
<outputDirectory>
${project.build.directory}/azure-functions/${functionAppName}
</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/azure
</directory>
<includes>
<include>**</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${stagingDirectory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<!--Remove obj folder generated by .NET SDK in maven clean-->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<filesets>
<fileset>
<directory>obj</directory>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>gsadev.nexus</id>
<name>Internal GSIDEV Repository</name>
<url>https://nexus.gsadev.net/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/libs-snapshot-local</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/release</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/libs-snapshot-local</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/libs-milestone-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
What I found strange is that the error does not ocurre if I simply remove the event hub annotation from the trigger method without doing any other changes to the code and/or pom:
#FunctionName("createAndSendToken")
public void run(
// #EventHubTrigger(name = "apiTokenRequests",
// eventHubName = "api-key-requests",
// connection = "EventhubConnectionString",
// consumerGroup = "digiapp",
// cardinality = Cardinality.ONE)
String payload,
final ExecutionContext context
) {
context.getLogger().info("EventHub trigger function execution started");
context.getLogger().info("payload:" + payload);
KeyResponse keyResponse = handleRequest(new KeyRequest(payload), context);
context.getLogger().info("EventHub trigger function execution finished with status " + keyResponse.getStatus());
}
Even more strange: I have an earlier version of the function derieved from an other example (which I don't find any more) that is not using spring.
Here the code with the eventhub trigger can be build by an azure pipeline without any issues.
the pom for that function looks like this:
<?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>de.digital.asap.azure</groupId>
<artifactId>cutcloud-token-service</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Cutcloud Token Service</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<azure.functions.maven.plugin.version>1.14.2</azure.functions.maven.plugin.version>
<azure.functions.java.library.version>1.4.2</azure.functions.java.library.version>
<functionAppName>cutcloud-token-service</functionAppName>
<stagingDirectory>${project.build.directory}/azure-functions/${functionAppName}</stagingDirectory>
</properties>
<repositories>
<repository>
<id>gsadev.nexus</id>
<name>Internal GSADEV Repository</name>
<url>https://nexus.gsadev.net/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.microsoft.azure.functions</groupId>
<artifactId>azure-functions-java-library</artifactId>
<version>${azure.functions.java.library.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.microsoft.azure</groupId>-->
<!-- <artifactId>applicationinsights-core</artifactId>-->
<!-- <version>2.6.3</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.microsoft.azure.sdk.iot</groupId>
<artifactId>iot-service-client</artifactId>
<version>1.33.2</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.12.5</version>
</dependency>
<dependency>
<groupId>net.gsadev.crypto</groupId>
<artifactId>crypto-lib</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>de.digital.asab.cloud</groupId>
<artifactId>cloud-messages</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<optional>true</optional>
</dependency>
<!-- <dependency>-->
<!-- <groupId>ch.qos.logback</groupId>-->
<!-- <artifactId>logback-core</artifactId>-->
<!-- <version>1.2.7</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>ch.qos.logback</groupId>-->
<!-- <artifactId>logback-classic</artifactId>-->
<!-- <version>1.2.7</version>-->
<!-- </dependency>-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.slf4j</groupId>-->
<!-- <artifactId>slf4j-api</artifactId>-->
<!-- <version>1.7.32</version>-->
<!-- </dependency>-->
<!-- Test -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<version>${azure.functions.maven.plugin.version}</version>
<configuration>
<appName>${functionAppName}</appName>
<resourceGroup>gsadev-sandbox</resourceGroup>
<appServicePlanName>TestServicePlan</appServicePlanName>
<region>westeurope</region>
<!-- function pricingTier, default to be consumption if not specified -->
<!-- refers https://github.com/microsoft/azure-maven-plugins/wiki/Azure-Functions:-Configuration-Details#supported-pricing-tiers for all valid values -->
<!-- <pricingTier></pricingTier> -->
<disableAppInsights>false</disableAppInsights>
<runtime>
<!-- runtime os, could be windows, linux or docker-->
<os>linux</os>
<javaVersion>8</javaVersion>
<!-- for docker function, please set the following parameters -->
<!-- <image>[hub-user/]repo-name[:tag]</image> -->
<!-- <serverId></serverId> -->
<!-- <registryUrl></registryUrl> -->
</runtime>
<appSettings>
<property>
<name>FUNCTIONS_EXTENSION_VERSION</name>
<value>~3</value>
</property>
</appSettings>
</configuration>
<executions>
<execution>
<id>package-functions</id>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<overwrite>true</overwrite>
<outputDirectory>${stagingDirectory}</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}</directory>
<includes>
<include>host.json</include>
<include>local.settings.json</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${stagingDirectory}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<includeScope>runtime</includeScope>
<excludeArtifactIds>azure-functions-java-library</excludeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
<!--Remove obj folder generated by .NET SDK in maven clean-->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<filesets>
<fileset>
<directory>obj</directory>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
</project>
The code and annotation for the older function trigger is the same as in the new code that can't be built for some reason.
I already tried different things like changing the version of the maven plugin, the azure libraries, the function version, and the extension bundle versions. etc.
I also tried different build/agent images:
pool:
vmImage: 'ubuntu-latest'
and
pool:
vmImage: 'ubuntu-22.04'
but nothing helped. I am out of ideas. Can anyone help, please?
regards
Christian
Because of the reasons mentioned above, I am still not convinced that this is the best solution but following the comment of #khmarbaise, I fixed my problem by installing the necessary tools manually into the build agent before calling the actual build step:
- task: Npm#1
inputs:
#this is needed so that the function extension install in the maven task doesn't fail
command: 'custom'
customCommand: 'install -g azure-functions-core-tools#3 --unsafe-perm true'

Vaadin 8 to 14 migration . ERROR in ../target/flow-frontend/VaadinDevmodeGizmo.js Module not found

I am trying Vaadin 8 to 14 MPR migration for which I have built a simple application which disaplys components created in Vaadin 8 and after migration to 14, I have to show them in UI.
During the Frontend compilation, I get errors as below
ERROR in ../target/flow-frontend/Flow.js
Module not found: Error: Can't resolve '#vaadin/common-frontend' in 'C:\Vaadin14\VaadinMPR\vadin-8-to-14-mpr-ui\target\flow-frontend'
# ../target/flow-frontend/Flow.js 1:0-79 77:60-75 260:8-27 270:52-67 274:56-71 277:56-71 284:52-67
# ../target/index.ts
# ./generated/vaadin.ts
ERROR in ../target/frontend/generated-flow-imports.js
Module not found: Error: Can't resolve '#vaadin/flow-frontend/ConnectionIndicator.js' in 'C:\Vaadin14\VaadinMPR\vadin-8-to-14-mpr-ui\target\frontend'
# ../target/frontend/generated-flow-imports.js 11:0-54
# ../target/index.ts
# ./generated/vaadin.ts
ERROR in ../target/flow-frontend/VaadinDevmodeGizmo.js
Module not found: Error: Can't resolve 'lit' in 'C:\Vaadin14\VaadinMPR\vadin-8-to-14-mpr-ui\target\flow-frontend'
# ../target/flow-frontend/VaadinDevmodeGizmo.js 7:0-53 123:40-50 144:15-18 1143:19-22 1146:19-22 1149:19-22 1152:19-22 1155:19-22 1160:15-19 1170:38-42 1172:14-18 1176:14-18 1190:15-19 1196:35-39 1224:86-93 1233:14-18 1254:14-18 1276:31-35 1276:108-115 1280:15-19 1292:15-19 1332:15-19 1337:39-43 1373:30-33 1374:31-34 1375:30-33 1376:32-35 1377:29-32
ERROR in ../target/flow-frontend/VaadinDevmodeGizmo.js
Module not found: Error: Can't resolve 'lit/decorators.js' in 'C:\Vaadin14\VaadinMPR\vadin-8-to-14-mpr-ui\target\flow-frontend'
# ../target/flow-frontend/VaadinDevmodeGizmo.js 8:0-59 1393:4-12 1396:4-12 1399:4-12 1402:4-12 1405:4-12 1408:4-12 1411:4-12 1414:4-12 1417:4-12 1420:4-12 1423:4-9 1426:4-9 1429:4-9 1432:4-9 1435:4-9 1438:4-9
ERROR in ../target/flow-frontend/VaadinDevmodeGizmo.js
Module not found: Error: Can't resolve 'lit/directives/class-map.js' in 'C:\Vaadin14\VaadinMPR\vadin-8-to-14-mpr-ui\target\flow-frontend'
# ../target/flow-frontend/VaadinDevmodeGizmo.js 9:0-55 1197:24-32
Child HtmlWebpackCompiler:
1 asset
Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
[../node_modules/.pnpm/html-webpack-plugin#4.5.1_webpack#4.46.0/node_modules/html-webpack-plugin/lib/loader.js!../target/index.html] 1.17 KiB {HtmlWebpackPlugin_0} [built]
i 「wdm」: Failed to compile.
------------------ Frontend compilation failed. ------------------
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\DumpStack.log.tmp'
Here is my pom.xml
<?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>org.example</groupId>
<artifactId>vadin-8-to-14-mpr-ui</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>vadin-8-to-14-mpr-ui</name>
<prerequisites>
<maven>3</maven>
</prerequisites>
<properties>
<!-- <vaadin.version>8.9.4</vaadin.version>-->
<vaadin.version>14.8.0</vaadin.version>
<vaadin.plugin.version>8.9.4</vaadin.plugin.version>
<jetty.plugin.version>9.4.43.v20210629</jetty.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</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.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>8.13.3</version>
<exclusions>
<exclusion>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-elemental</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
<version>8.13.3</version>
</dependency>
<!-- <dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
</dependency>-->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>8.7.0</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-core</artifactId>
<version>14.8.0</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>mpr-v8</artifactId>
</dependency>
<!-- External dependencies-->
0
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-server</artifactId>
<version>6.0.4</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-client</artifactId>
<version>9.0.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</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>com.vaadin</groupId>
<artifactId>flow-maven-plugin</artifactId>
<version>2.0.7</version>
<executions>
<execution>
<goals>
<goal>prepare-frontend</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.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>
<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>
<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>
Tried following steps:
Deleted the npm modules, package.json, webpack.config.js, webpack.generated.js, target folders and ran
mvn clean package
Ran mvn clean install
Tried solutions as in the links
Cannot find module '#vaadin/flow-frontend/Flow'
https://vaadin.com/forum/thread/17762163/module-not-found#
https://vaadin.com/forum/thread/17883890/webpack-error-can-t-resolve-vaadin-flow-frontend-flow-component-renderer
Nothing helped
Can you please give me leads on how to fix it?

Configure Maven pom to access Vaadin 14 alpha/beta pre-release

I see on the documentation page for Vaadin Flow that while version 14.0.4 is current, there a version 14.0.0alpha1.
Merely updating this element in my Maven POM:
<vaadin.version>14.1.0alpha1</vaadin.version>
…is not enough, as this pre-release is not yet available in the usual Maven repositories. As I vaguely recall from past experience, I need to configure my POM to access a special Maven repository for Vaadin pre-release versions. But cannot recall the details, and I am no Maven maven.
I am pasting my <repositories> block of my POM here, where the prereleases repository is defined, next to the add-ons repository which probably is used more often.
<repositories>
<!-- to test prerelease versions of Vaadin -->
<repository>
<id>Vaadin Prereleases</id>
<url>https://maven.vaadin.com/vaadin-prereleases</url>
</repository>
<!-- If you have at least 1 add-on, then you need this-->
<repository>
<id>Vaadin Directory</id>
<url>https://maven.vaadin.com/vaadin-addons</url>
</repository>
</repositories>
Sir, it is available in mvnrepository.com. I provide below the link.
https://mvnrepository.com/artifact/com.vaadin/vaadin/14.1.0.alpha1
<!-- https://mvnrepository.com/artifact/com.vaadin/vaadin -->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<version>14.1.0.alpha1</version>
</dependency>
I provide below the links.
Vaadin pre-releases moved to new repository
I also found the sample github link.
https://github.com/thinwire/VaadinArchetypeAlpha
I found my own Answer to my own Question about an earlier version of Vaadin (1 & 12). The centerpiece of that Answer applies here.
Make these three edits to your Maven POM file.
(1) Version
Change:
<vaadin.version>14.0.4</vaadin.version>
…to:
<vaadin.version>14.1.0.beta3</vaadin.version>
(2) Add a <repository>
Inside the <repositories> tag, add this element:
<!-- https://stackoverflow.com/a/57913824/642706 -->
<repository>
<id>vaadin-prereleases</id>
<url>https://maven.vaadin.com/vaadin-prereleases</url>
</repository>
(3) Add <pluginRepositories>
Between the end of the <repositories> element and the beginning of the <dependencyManagement> element, paste:
<pluginRepositories>
<!-- Repository needed for prerelease versions of Vaadin -->
<pluginRepository>
<id>vaadin-prereleases</id>
<url>https://maven.vaadin.com/vaadin-prereleases</url>
</pluginRepository>
</pluginRepositories>
(4) Maven clean/install
Save your POM. Do a Maven clean and install. Wait. And wait. And wait some more for many downloads, hundreds, maybe more. Takes several minutes on a 70 Mbps internet connection.
Then you should be able to run your web app with the new alpha or beta version of Vaadin 14.
Here is an example POM that is currently working for me. May have some extra <dependency> relevant to my project that you can ignore.
<?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>work.basil.ticktock</groupId>
<artifactId>ticktock</artifactId>
<name>ticktock</name>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<maven.compiler.source>13</maven.compiler.source>
<maven.compiler.target>13</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
<vaadin.version>14.1.0.beta3</vaadin.version>
<drivers.downloader.phase>pre-integration-test</drivers.downloader.phase>
</properties>
<repositories>
<!--https://stackoverflow.com/questions/53028557/change-maven-driven-project-based-on-vaadin-11-to-vaadin-12-alpha-version-->
<repository>
<id>vaadin-prereleases</id>
<url>https://maven.vaadin.com/vaadin-prereleases</url>
</repository>
<!-- Repository used by many Vaadin add-ons -->
<repository>
<id>Vaadin Directory</id>
<url>https://maven.vaadin.com/vaadin-addons</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
<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>
<!-- Replace artifactId with vaadin-core to use only free components -->
<!-- <artifactId>vaadin</artifactId>-->
<artifactId>vaadin-core</artifactId>
<exclusions>
<!-- Webjars are only needed when running in Vaadin 13 compatibility mode -->
<exclusion>
<groupId>com.vaadin.webjar</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.insites</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.polymer</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.polymerelements</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.vaadin</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.webjars.bowergithub.webcomponents</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Added to provide logging output as Vaadin 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>4.0.1</version>
<scope>provided</scope>
</dependency>
<!-- <dependency>-->
<!-- <groupId>jakarta.servlet</groupId>-->
<!-- <artifactId>jakarta.servlet-api</artifactId>-->
<!-- <version>4.0.3</version>-->
<!-- <scope>provided</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-testbench</artifactId>
<scope>test</scope>
</dependency>
<!--Basil-->
<!-- <!– https://mvnrepository.com/artifact/com.google.code.findbugs/jsr305 –>-->
<!-- <dependency>-->
<!-- <groupId>com.google.code.findbugs</groupId>-->
<!-- <artifactId>jsr305</artifactId>-->
<!-- <version>3.0.2</version>-->
<!-- </dependency>-->
<!-- https://mvnrepository.com/artifact/org.jetbrains/annotations -->
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>17.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.flywaydb/flyway-core -->
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>6.0.0</version>
</dependency>
</dependencies>
<build>
<defaultGoal>jetty:run</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<!-- Jetty plugin for easy testing without a server -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>10.0.0-alpha0</version>
<configuration>
<!-- If using IntelliJ IDEA with autocompilation, this
might cause lots of unnecessary compilations in the
background.-->
<scanIntervalSeconds>2</scanIntervalSeconds>
<!-- Use war output directory to get the webpack files -->
<webAppConfig>
<allowDuplicateFragmentNames>true</allowDuplicateFragmentNames>
</webAppConfig>
</configuration>
</plugin>
<!--
Take care of synchronizing java dependencies and imports in
package.json and main.js files.
It also creates webpack.config.js if not exists yet.
-->
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-frontend</goal>
</goals>
</execution>
</executions>
</plugin>
<!--Basil-->
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<!-- Use the latest released version:
https://repo1.maven.org/maven2/com/github/eirslett/frontend-maven-plugin/ -->
<version>1.8.0</version>
<executions>
<execution>
<!-- optional: you don't really need execution ids, but it looks nice in your build log. -->
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<!-- optional: default phase is "generate-resources" -->
<phase>generate-resources</phase>
</execution>
</executions>
<configuration>
<nodeVersion>v10.16.3</nodeVersion>
<!-- optional: with node version greater than 4.0.0 will use npm provided by node distribution -->
<!-- <npmVersion>2.15.9</npmVersion>-->
<!-- optional: where to download node and npm from. Defaults to https://nodejs.org/dist/ -->
<!-- <downloadRoot>http://myproxy.example.org/nodejs/</downloadRoot>-->
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- Production mode is activated using -Pproduction -->
<id>production</id>
<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>
<executions>
<execution>
<goals>
<goal>build-frontend</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integration-tests</id>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.15.v20190215</version>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<stopPort>8081</stopPort>
<stopWait>5</stopWait>
<stopKey>${project.artifactId}</stopKey>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>deploy-war</goal>
</goals>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Runs the integration tests (*IT) after the server is started -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<trimStackTrace>false</trimStackTrace>
<enableAssertions>true</enableAssertions>
<systemPropertyVariables>
<!-- Pass location of downloaded webdrivers to the tests -->
<webdriver.chrome.driver>${webdriver.chrome.driver}</webdriver.chrome.driver>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>com.lazerycode.selenium</groupId>
<artifactId>driver-binary-downloader-maven-plugin</artifactId>
<version>1.0.17</version>
<configuration>
<onlyGetDriversForHostOperatingSystem>true
</onlyGetDriversForHostOperatingSystem>
<rootStandaloneServerDirectory>
${project.basedir}/drivers/driver
</rootStandaloneServerDirectory>
<downloadedZipFileDirectory>
${project.basedir}/drivers/driver_zips
</downloadedZipFileDirectory>
<customRepositoryMap>
${project.basedir}/drivers.xml
</customRepositoryMap>
</configuration>
<executions>
<execution>
<!-- use phase "none" to skip download step -->
<phase>${drivers.downloader.phase}</phase>
<goals>
<goal>selenium</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

Spring reactive rest service returning ServerResponse object

I'm having issues trying to return ServerResponse object fro a reactive rest service
#RequestMapping(path = "/", method = RequestMethod.GET)
public Mono<ServerResponse> getPages(#RequestParam(value = "siteId", required = false) String siteId,
#RequestParam(value = "parentId", required = false) String parentId) throws Exception {
Flux<MyModel> result = pageModelService.getMyModels(Id, name);
return ServerResponse.ok().body(result, MyModel.class).switchIfEmpty(ServerResponse.notFound().build());
}
I'm getting
javax.servlet.ServletException:
org.springframework.web.util.NestedServletException: Request
processing failed; nested exception is
java.lang.IllegalArgumentException: No converter found for return
value of type: class
org.springframework.web.reactive.function.server.DefaultEntityResponseBuilder$DefaultEntityResponse
here's my pom.xml
<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>
<artifactId>xxxx</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>xx.xxxx</groupId>
<artifactId>xxxx-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<jetty.version>9.4.5.v20170502</jetty.version>
<spring.version>5.0.0.RC2</spring.version>
<spring-boot.version>2.0.0.M1</spring-boot.version>
<spring-cloud.version>Finchley.BUILD-SNAPSHOT</spring-cloud.version>
<servlet-api.version>3.1.0</servlet-api.version>
<lombok.version>1.16.10</lombok.version>
<pebble-spring-boot-starter.version>2.3.0</pebble-spring-boot-starter.version>
<springfox.version>2.6.1</springfox.version>
<reactor.version>3.1.0.M2</reactor.version>
<rxjava-reactive-streams.version>1.2.1</rxjava-reactive-streams.version>
<orika.version>1.5.1</orika.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- Jetty BOM -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-bom</artifactId>
<version>${jetty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Spring BOM -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework-bom</artifactId>
<version>${spring.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Spring Boot versions -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
<version>1.7.25</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Spring Jetty (Http Server) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<!-- Spring Webflux (Reactive Spring MVC) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<!-- Spring Config (Centralized configuration) -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<!-- Spring Actuator (Management endpoints) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Spring Sleuth (request tracking) -->
<!-- dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency-->
<!-- Spring Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Spring Freemarker Template -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-freemarker</artifactId>
<exclusions>
<exclusion>
<artifactId>spring-webmvc</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- Jetty Proxy -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-proxy</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
</dependency>
<!-- Lombok (IDE tool) -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox.version}</version>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>${reactor.version}</version>
</dependency>
<dependency>
<groupId>io.reactivex</groupId>
<artifactId>rxjava-reactive-streams</artifactId>
<version>${rxjava-reactive-streams.version}</version>
</dependency>
<dependency>
<groupId>ma.glasnost.orika</groupId>
<artifactId>orika-core</artifactId>
<version>${orika.version}</version>
</dependency>
</dependencies>
<repositories>
<!-- Spring Snapshot -->
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<!-- Spring Milestones -->
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<!-- Spring Snapshot -->
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<!-- Spring Milestones -->
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<!-- Required: The following will ensure `npm install` is called
before anything else during the 'Default Lifecycle' -->
<execution>
<id>npm install (initialize)</id>
<goals>
<goal>exec</goal>
</goals>
<phase>initialize</phase>
<configuration>
<executable>npm</executable>
<workingDirectory>src/main/resources/angular</workingDirectory>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>npm build</id>
<goals>
<goal>exec</goal>
</goals>
<phase>initialize</phase>
<configuration>
<executable>ng</executable>
<workingDirectory>src/main/resources/angular</workingDirectory>
<arguments>
<argument>build</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/config</directory>
</resource>
<resource>
<filtering>false</filtering>
<directory>src/main/resources</directory>
<includes>
<include>static/**</include>
</includes>
</resource>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/*.src.less</exclude>
<exclude>**/*.src.js</exclude>
<exclude>static/**</exclude>
<exclude>angular/**</exclude>
</excludes>
</resource>
</resources>
</build>
</project>
I tried to add jackson dependencies, but seems it's another issue
any idea would be welcome
From this answer:
ServerResponse is meant to be used with WebFlux Handlers and not with RestControllers.
By default, spring-boot-starter-webflux will use Reactor Netty as webflux runtime.
If you want to use Jetty as target runtime, just exclude spring-boot-starter-reactory-netty in spring-boot-starter-webflux dependency and add spring-boot-starter-jetty explicitly.
Then simply declares Spring boot as parent POM.
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.M3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
Clean other unuse dependencies, remove your dependencyManagement.
Check my working sample(but I am using the default Reactor Netty as runtime):
Vanllia version: https://github.com/hantsy/spring-reactive-sample/tree/master/vanilla
Spring Boot version: https://github.com/hantsy/spring-reactive-sample/tree/master/boot

Resources