首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >当我在IntelliJ中运行项目时,maven为什么使用Vaadin插件的旧版本?

当我在IntelliJ中运行项目时,maven为什么使用Vaadin插件的旧版本?
EN

Stack Overflow用户
提问于 2020-07-03 05:50:44
回答 1查看 370关注 0票数 0

我使用Wildfly 20IntelliJ latest版本,并在启用的pom.xmlpnpm中使用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检查了所有传递依赖项。

任何人都知道为什么会发生这种情况,我应该做些什么来阻止它呢?

代码语言:javascript
运行
复制
<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,则会得到以下错误

代码语言:javascript
运行
复制
    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>
EN

回答 1

Stack Overflow用户

发布于 2020-07-03 05:58:43

尝试以下步骤:

mvn clean install -U

  • Open

  • Do

  • IntelliJ

  • 中的项目视图,右键单击pom.xml文件,选择Maven - Reimport (如果对您有效),IntelliJ将将依赖项添加到项目

  • 中,检查是否在文件-项目结构-项目设置-库和文件-项目结构-模块- Dependencies.

中添加了所需的依赖项。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62709258

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档