我被困住了,我无法编译我的spring boot vaadin项目用于生产。 这是我的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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.3.RELEASE</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<groupId>de.kreth.clubhelper</groupId>
<artifactId>clubhelper-attendance</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>clubhelper-attendance</name>
<description>UI App for Clubhelper Attendance</description>
<properties>
<java.version>11</java.version>
<org.keycloak.version>11.0.1</org.keycloak.version>
<vaadin.version>14.3.4</vaadin.version>
<flow.maven.plugin.version>4.0.4</flow.maven.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-spring-security-adapter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>${vaadin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.keycloak.bom</groupId>
<artifactId>keycloak-adapter-bom</artifactId>
<version>${org.keycloak.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>prepare-frontend</goal>
<goal>build-frontend</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>node_modules</directory>
<includes>
<include>**</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<directory>.</directory>
<includes>
<include>*.json</include>
<include>*.js</include>
<include>pnpm-lock.yaml</include>
<include>types.d.ts</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>productionMode</id>
<activation>
<property>
<name>vaadin.productionMode</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>flow-server-production-mode</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>flow-maven-plugin</artifactId>
<version>${flow.maven.plugin.version}</version>
<executions>
<execution>
<goals>
<goal>copy-production-files</goal>
<goal>package-for-production</goal>
</goals>
<configuration>
<transpileOutputDirectory>${webapp.directory}</transpileOutputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>-Dvaadin.productionMode</jvmArguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
这是我正在使用的maven命令:
mvn -Pvaadin.productionMode clean vaadin:prepare-frontend vaadin:build-frontend package
这是输出:
:~/app$ mvn -Pvaadin.productionMode clean vaadin:prepare-frontend vaadin:build-frontend package
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for my.app :app :jar:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for com.vaadin:vaadin-maven-plugin is missing. @ line 106, column 12
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] -------------< my.app :app >--------------
[INFO] Building app 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ app ---
[INFO] Deleting /home/markus/docker-compose-executions/app /app /target
[INFO] Deleting /home/markus/docker-compose-executions/app /app /node_modules (includes = [**], excludes = [])
[INFO] Deleting /home/markus/docker-compose-executions/app /app (includes = [*.json, *.js, pnpm-lock.yaml, types.d.ts], excludes = [])
[INFO]
[INFO] --- vaadin-maven-plugin:17.0.7:prepare-frontend (default-cli) @ app ---
[INFO] Added 19 default dependencies to main package.json
[INFO] writing file /home/markus/docker-compose-executions/app /app /package.json.
[INFO] writing file /home/markus/docker-compose-executions/app /app /target/flow-frontend/package.json.
[INFO] writing file /home/markus/docker-compose-executions/app /app /target/flow-frontend/form/package.json.
[INFO] writing file '/home/markus/docker-compose-executions/app /app /target/index.html'
[INFO] writing file '/home/markus/docker-compose-executions/app /app /target/index.ts'
[INFO] writing file '/home/markus/docker-compose-executions/app /app /tsconfig.json'
[INFO] writing file '/home/markus/docker-compose-executions/app /app /types.d.ts'
[INFO] Copying frontend resources from jar files ...
[INFO] Visited 162 resources. Took 268 ms.
[INFO] Created webpack configuration file: '/home/markus/docker-compose-executions/app /app /webpack.config.js'
[INFO]
[INFO] --- vaadin-maven-plugin:17.0.7:build-frontend (default-cli) @ app ---
[INFO] Scanning classes to find frontend configurations and dependencies...
[INFO] Visited 647 classes. Took 1279 ms.
[INFO] Visited 86 classes. Took 47 ms.
[INFO] writing file /home/markus/docker-compose-executions/app /app /target/flow-frontend/package.json.
[INFO] writing file /home/markus/docker-compose-executions/app /app /target/flow-frontend/form/package.json.
[INFO] writing file '/home/markus/docker-compose-executions/app /app /target/index.html'
[INFO] writing file '/home/markus/docker-compose-executions/app /app /target/index.ts'
[INFO] Parsing java files from [/home/markus/docker-compose-executions/app /app /src/main/java]
[INFO] There are no connect endpoints to generate.
[INFO] Added 33 dependencies to main package.json
[INFO] writing file /home/markus/docker-compose-executions/app /app /package.json.
[INFO] Running `pnpm install` to resolve and optionally download frontend dependencies. This may take a moment, please stand by...
[WARNING] Couldn't find dev dependencies file. Dev dependencies won't be locked
[INFO] Generated pnpmfile hook file: '/home/markus/docker-compose-executions/app /app /pnpmfile.js'
[INFO] installing pnpm version 4.4.0 locally
[INFO] using '/usr/bin/node /home/markus/.vaadin/node_modules/pnpm/bin/pnpm.js' for frontend package installation
[INFO] Frontend dependencies resolved successfully.
[INFO] Copying frontend resources from jar files ...
[INFO] Visited 162 resources. Took 66 ms.
[INFO] Updated /home/markus/docker-compose-executions/app /app /target/frontend/generated-flow-imports-fallback.js
[INFO] Updated /home/markus/docker-compose-executions/app /app /target/frontend/generated-flow-imports.js
[INFO] Updated /home/markus/docker-compose-executions/app /app /target/frontend/generated-flow-imports.d.ts
[INFO] Running webpack ...
: Using typescript@3.8.3 from typescript
: Using tsconfig.json from /home/markus/docker-compose-executions/app /app /tsconfig.json
: Checking started in a separate process...
: Checking finished with 1 errors
Hash: c1391e3e8704817266b9
Version: webpack 4.42.0
Time: 15519ms
Built at: 2020-10-25 22:59:27
5 assets
Entrypoint bundle =
Entrypoint export = build/vaadin-export-040d8e0d55fe4b3daad3.cache.js
[23] ../node_modules/.pnpm/registry.npmjs.org/@polymer/polymer/3.2.0/node_modules/@polymer/polymer/lib/elements/custom-style.js + 1 modules 6.24 KiB {1} {3} [built]
| 2 modules
[43] ../node_modules/.pnpm/registry.npmjs.org/@polymer/iron-icon/3.0.1/node_modules/@polymer/iron-icon/iron-icon.js + 1 modules 16 KiB {1} {3} [built]
| 2 modules
[47] ../node_modules/.pnpm/registry.npmjs.org/@vaadin/vaadin-lumo-styles/1.6.0/node_modules/@vaadin/vaadin-lumo-styles/icons.js + 1 modules 14.3 KiB {1} {3} [built]
| 2 modules
[48] ../target/frontend/generated-flow-imports.js 1.35 KiB {1} {5} [built]
[49] ../target/index.ts + 1 modules 92.2 KiB {0} [built]
| ../target/index.ts 1.43 KiB [built]
| + 1 hidden module
[50] ../target/frontend/generated-flow-imports-fallback.js + 8 modules 15.3 KiB {4} [built]
| ../target/frontend/generated-flow-imports-fallback.js 3.95 KiB [built]
| ../target/flow-frontend/comboBoxConnector-es6.js 417 bytes [built]
| ../target/flow-frontend/contextMenuConnector-es6.js 319 bytes [built]
| ../target/flow-frontend/dndConnector-es6.js 29 bytes [built]
| ../target/flow-frontend/flow-component-renderer.js 5.23 KiB [built]
| ../target/flow-frontend/gridConnector-es6.js 590 bytes [built]
| ../target/flow-frontend/ironListConnector-es6.js 255 bytes [built]
| ../target/flow-frontend/ironListStyles.js 320 bytes [built]
| ../target/flow-frontend/vaadin-grid-flow-selection-column.js 3.88 KiB [built]
[56] ../node_modules/.pnpm/registry.npmjs.org/@vaadin/vaadin-text-field/2.6.2/node_modules/@vaadin/vaadin-text-field/theme/lumo/vaadin-text-field.js + 1 modules 11.1 KiB {2} [built]
| 2 modules
[71] ../node_modules/.pnpm/registry.npmjs.org/@vaadin/vaadin-item/2.2.0/node_modules/@vaadin/vaadin-item/theme/lumo/vaadin-item.js + 1 modules 2.23 KiB {2} [built]
| 2 modules
[76] ../node_modules/.pnpm/registry.npmjs.org/@vaadin/vaadin-list-box/1.3.0/node_modules/@vaadin/vaadin-list-box/theme/lumo/vaadin-list-box.js + 1 modules 2.85 KiB {2} [built]
| 2 modules
[77] ../node_modules/.pnpm/registry.npmjs.org/@vaadin/vaadin-text-field/2.6.2/node_modules/@vaadin/vaadin-text-field/theme/lumo/vaadin-password-field.js + 1 modules 1.06 KiB {2} [built]
| 2 modules
[111] ../node_modules/.pnpm/registry.npmjs.org/@vaadin/vaadin-date-picker/4.2.0/node_modules/@vaadin/vaadin-date-picker/theme/lumo/vaadin-date-picker.js + 6 modules 13.9 KiB {2} [built]
| 7 modules
[114] ../node_modules/.pnpm/registry.npmjs.org/@vaadin/vaadin-time-picker/2.2.0/node_modules/@vaadin/vaadin-time-picker/theme/lumo/vaadin-time-picker.js + 3 modules 1.73 KiB {2} [built]
| 4 modules
[115] ../node_modules/.pnpm/registry.npmjs.org/@vaadin/vaadin-login/1.1.0/node_modules/@vaadin/vaadin-login/theme/lumo/vaadin-login-form.js + 2 modules 883 bytes {2} [built]
| 3 modules
[117] ../node_modules/.pnpm/registry.npmjs.org/@vaadin/vaadin-context-menu/4.4.0/node_modules/@vaadin/vaadin-context-menu/theme/lumo/vaadin-context-menu.js + 1 modules 4.92 KiB {2} [built]
| 2 modules
[118] ../node_modules/.pnpm/registry.npmjs.org/@vaadin/vaadin-custom-field/1.1.0/node_modules/@vaadin/vaadin-custom-field/theme/lumo/vaadin-custom-field.js + 1 modules 2.87 KiB {2} [built]
| 2 modules
+ 152 hidden modules
ERROR in ../target/index.ts
Module not found: Error: Can't resolve '@vaadin/flow-frontend/Flow' in '/home/markus/docker-compose-executions/app /app /target'
@ ../target/index.ts 15:0-50 16:33-37
ERROR in chunk bundle [entry]
build/vaadin-bundle-abadb23bac92212c113c.cache.js
/home/markus/docker-compose-executions/app /app /node_modules/.pnpm/registry.npmjs.org/awesome-typescript-loader/5.2.1_typescript@3.8.3/node_modules/awesome-typescript-loader/dist/entry.js!/home/markus/docker-compose-executions/app /app /target/index.ts f94cc97538a37d57399caa03b213501e
Unexpected token (17:33)
| // import Flow module to enable navigation to Vaadin server-side views
|
| const { serverSideRoutes } = new !(function webpackMissingModule() { var e = new Error("Cannot find module '@vaadin/flow-frontend/Flow'"); e.code = 'MODULE_NOT_FOUND'; throw e; }())({
| imports: () => Promise.all(/* import() */[__webpack_require__.e(3), __webpack_require__.e(5)]).then(__webpack_require__.bind(null, 48))
| });
ERROR in [at-loader] ./target/index.ts:18:20
TS2307: Cannot find module '@vaadin/flow-frontend/Flow'.
Child html-webpack-plugin for "index.html":
1 asset
Entrypoint undefined = index.html
[0] ../node_modules/.pnpm/registry.npmjs.org/html-webpack-plugin/3.2.0_webpack@4.42.0/node_modules/html-webpack-plugin/lib/loader.js!../target/index.html 1.13 KiB {0} [built]
+ 3 hidden modules
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 51.978 s
[INFO] Finished at: 2020-10-25T22:59:27+01:00
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "vaadin.productionMode" could not be activated because it does not exist.
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:17.0.7:build-frontend (default-cli) on project app : Webpack process exited with non-zero exit code.
[ERROR] Stderr: ''
[ERROR] -> [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
我没有其他想法了,这是怎么了。 我在这里尝试了说明: https://vaadin.com/docs/flow/production/tutorial-production-mode-basic.html 但是'executions'标签使maven失败了。 摘录来自这里: https://github.com/vaadin/flow-spring-examples/blob/master/pom.xml
原始{甚至不工作的)pom.xml是从https://start.spring.io/生成的
我认为我的pom.xml缺少某些内容,但我不知道是什么。 有人使用Spring Boot和vaadin运行了pom.xml吗?
重新阅读并尝试删除和添加插件后,我认为错误是此行: ''' 错误:无法解析“ @ vaadin / flow-frontend / Flow” ''' 为什么不编译以及如何编译?