I have a multi-module maven project where we use vaadin-maven-plugin in “ptsmc-widgetset”.
It is not a standalone project in itself, but a dependency for several of the other modules.
We do not use vaadin-dev, so when we build, we want to always build prod.bundle
We check in everything under src. Goal is that only one dev has to go through any node build, and we always get the exact same bundle.
I’m having several kinds of problems with this setup:
If I do “mvn clean package” on the top project, several files, like src\main\frontend\generated\index.tsx are deleted.
If I do “mvn clean package” on ptsmc-widgetset, they are restored.
If I do Alt-F5 on ptsmc-widgetset (or all) in Eclipse, the files are also deleted.
Trying to fix this I ended up in a variety of other situations:
- prod.bundle was constantly changed
- Everything looked fine, but Eclipse didn’t copy META-INF/VAADIN to target
So, struggling with the right invocations to get the behavior I want.
We’re on Vaadin 25.1.1
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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.ec.ptsmc</groupId>
<artifactId>ptsmc-wildfly-parent</artifactId>
<version>${revision}${sha1}${changelist}</version>
<relativePath>../ptsmc-wildfly-parent</relativePath>
</parent>
<artifactId>ptsmc-widgetset</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-core</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.vaadin</groupId>
<artifactId>hilla-dev</artifactId>
</exclusion>
<exclusion>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-dev</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>software.xdev.vaadin.maps-leaflet</groupId>
<artifactId>flow</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin.componentfactory</groupId>
<artifactId>selection-grid-flow</artifactId>
<version>${selection.grid.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<!--
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>
<executions>
<execution>
<goals>
<goal>prepare-frontend</goal>
<goal>build-frontend</goal>
</goals>
</execution>
</executions>
<configuration>
<optimizeBundle>false</optimizeBundle>
</configuration>
</plugin>
</plugins>
</build>
</project>
directory structure:
+---src
¦ +---main
¦ +---bundles
¦ ¦ prod.bundle
¦ ¦
¦ +---frontend
¦ ¦ ¦ index.html
¦ ¦ ¦ ptsmc-split-layout.ts
¦ ¦ ¦
¦ ¦ +---generated
¦ ¦ ¦ ¦ app-shell-imports.d.ts
¦ ¦ ¦ ¦ app-shell-imports.js
¦ ¦ ¦ ¦ css.generated.d.ts
¦ ¦ ¦ ¦ css.generated.js
¦ ¦ ¦ ¦ index.tsx
¦ ¦ ¦ ¦ layouts.json
¦ ¦ ¦ ¦ routes.tsx
¦ ¦ ¦ ¦ vaadin-featureflags.js
¦ ¦ ¦ ¦ vaadin-react.tsx
¦ ¦ ¦ ¦ vaadin.ts
¦ ¦ ¦ ¦
...
¦ ¦
¦ +---java
¦ +---com
¦ +---ptsmc
¦ +---widgetset
¦ +---splitlayout
¦ PtsmcSplitLayout.java
¦
+---target
¦ ptsmc-widgetset-5.17.0-SNAPSHOT.jar
¦ vaadin-dev-server-settings.json
¦
+---classes
¦ +---com
¦ ¦ +---ptsmc
¦ ¦ +---widgetset
¦ ¦ +---splitlayout
¦ ¦ PtsmcSplitLayout$Orientation.class
¦ ¦ PtsmcSplitLayout$SplitterDragEndEvent.class
¦ ¦ PtsmcSplitLayout.class
¦ ¦
¦ +---META-INF
¦ +---VAADIN
¦ +---config
¦ ¦ bundle-size.html
¦ ¦ stats.json
¦ ¦
¦ +---webapp
¦ ¦ index.html
¦ ¦ index.html.br
¦ ¦
¦ +---VAADIN
¦ +---build
¦ ¦ commonjsHelpers-CqkleIqs.js
¦ ¦ commonjsHelpers-CqkleIqs.js.br
¦ ¦ FlowBootstrap-DSmR1u5w.js
¦ ¦ FlowBootstrap-DSmR1u5w.js.br
¦ ¦ FlowClient-BVwyxPyR.js
¦ ¦ FlowClient-BVwyxPyR.js.br
¦ ¦ generated-flow-imports-BSycH1-g.js
¦ ¦ generated-flow-imports-BSycH1-g.js.br
¦ ¦ indexhtml-r929Ks8_.js
¦ ¦ indexhtml-r929Ks8_.js.br
¦ ¦
¦ +---static
¦ +---themes
¦ +---ptsmc
¦ theme.json
...