我使用Wildfly 20
和IntelliJ latest
版本,并在启用的pom.xml
和pnpm
中使用vaadin-maven-plugin 14.2.2
。
一个非常丑陋的问题发生在我无法理解的事情上。当我通过IntelliJ运行我的项目时,运行配置会发生一些奇怪的事情。IntelliJ使用了一个较旧版本的vaadin,即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: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>
发布于 2020-07-03 05:58:43
尝试以下步骤:
mvn clean install -U
中添加了所需的依赖项。
https://stackoverflow.com/questions/62709258
复制相似问题