java - 为什么我在IntelliJ中运行项目时maven使用旧版本的Vaadin插件?
问题描述
我在我的和启用中使用Wildfly 20
和IntelliJ latest
版本。vaadin-maven-plugin 14.2.2
pom.xml
pnpm
一个非常丑陋的问题发生了,我不明白为什么。当我通过 IntelliJ 运行配置运行我的项目时,会发生一些奇怪的事情。IntelliJ 使用旧版本的 vaadin-plugin,即vaadin-maven-plugin 14.2.0
我的 pom.xml 中没有它。
我已经尝试mvn help:effective-pom
查看 pom 中是否存在此依赖项的多个版本,并使用检查了所有传递依赖项mvn dependency:tree
任何人都知道为什么会发生这种情况,我应该怎么做才能防止它?
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<vaadin.version>14.2.2</vaadin.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>show-profiles</id>
<phase>compile</phase>
<goals>
<goal>active-profiles</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-frontend</goal>
</goals>
</execution>
</executions>
<configuration>
<pnpmEnable>true</pnpmEnable>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<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>
<version>${vaadin.version}</version>
<executions>
<execution>
<goals>
<goal>build-frontend</goal>
</goals>
</execution>
</executions>
<configuration>
<pnpmEnable>true</pnpmEnable>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
如果我使用 wildfly 插件并执行,wildfly:run
我会收到以下错误
ERROR in ../target/frontend/generated-flow-imports-fallback.js
Module not found: Error: Can't resolve '@vaadin/flow-frontend/?babel-target=es5' in 'C:\workspace\user-web\target\frontend'
@ ../target/frontend/generated-flow-imports-fallback.js 45:0-32
@ ../target/frontend/generated-flow-imports.js?babel-target=es5
ERROR in ../target/frontend/generated-flow-imports-fallback.js
Module not found: Error: Can't resolve '@vaadin/flow-frontend/?babel-target=es6' in 'C:\workspace\user-web\target\frontend'
@ ../target/frontend/generated-flow-imports-fallback.js 45:0-32
@ ../target/frontend/generated-flow-imports.js?babel-target=es6
Failed to execute goal com.vaadin:vaadin-maven-plugin:14.2.2:build-frontend
(default) on project user-web: Webpack process exited with non-zero exit code.
Stderr: ''
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>2.1.0.Beta1</version>
<configuration>
<server-args>
<server-arg>-Duser.properties.file=C:\appserver.properties</server-arg>
</server-args>
</configuration>
</plugin>
解决方案
尝试以下步骤:
- 做
mvn clean install -U
- 在 IntelliJ 中打开项目视图
- 右键单击 pom.xml 文件并
- 选择 Maven - Reimport 如果这对您有用,IntelliJ 会将依赖项添加到项目中
- 检查是否在文件 - 项目结构 - 项目设置 - 库和文件 - 项目结构 - 模块 - 依赖项中添加了您需要的依赖项。
推荐阅读
- html - 具有 2 级和 3 级的全宽子菜单
- spring - 春季启动并使用facebook做出反应登录
- r - R - 用来自另一个矩阵的特定数据块的数据填充矩阵
- ios - iOS 11 prefersLargeTitles 在方向更改后不扩展
- javascript - 重新加载 Puppeteer => page.setCookie(...cookies) 后 Cookies 消失了
- llvm - LLVM 中的 OpaqueType::get() 函数
- matlab - 在matlab中读取具有可变条目数的文本文件
- ruby - 检查 Ruby 代码中的命令行参数是否存在
- c# - 在 connectionString 中添加新连接
- backup - 使用命令行工具备份 STM32 固件