【问题标题】:Error while adding vaadin to Spring boot project in Intellij IDEA在 Intellij IDEA 中将 vaadin 添加到 Spring Boot 项目时出错
【发布时间】:2020-07-31 21:39:15
【问题描述】:

我在将 Vaadin 添加到我的 Spring 引导项目时遇到了这些错误(我正在使用 Intellij IDEA):

Cannot resolve plugin com.vaadin:vaadin-maven-plugin:${vaadin.version}
Cannot resolve com.vaadin:vaadin-spring-boot-starter:${vaadin.version}

这是 pom.xml 中的相关部分,与 vaadin 网站上提出的相同:

        <<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-bom</artifactId>
            <!-- declare the latest Vaadin version
                 as a property or directly here -->
            <version>${vaadin.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>
            vaadin-spring-boot-starter
        </artifactId>
        <version>${vaadin.version}</version>
    </dependency>
</dependencies>
<build>
    <plugins>
        <!-- The Spring Boot Maven plugin for easy
             execution from CLI and packaging -->
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>
                spring-boot-maven-plugin
            </artifactId>
        </plugin>

        <!--
            Takes care of synchronizing java
            dependencies and imports in package.json and
            main.js files. It also creates
            webpack.config.js if does not exist yet.
        -->
        <plugin>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-maven-plugin</artifactId>
            <version>${vaadin.version}</version>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-frontend</goal>
                        <goal>build-frontend</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

我该如何解决? 我需要配置其他东西吗?

谢谢

【问题讨论】:

    标签: spring-boot maven dependencies vaadin pom.xml


    【解决方案1】:

    该错误表明您在 pom.xml 中的&lt;properties&gt; sn-p 中缺少&lt;vaadin.version&gt;VersionYourWantToUse&lt;/vaadin.version&gt; property。例如,Vaadin spring boot starter 在其pom.xml file 中有此部分:

       <properties>
            <maven.compiler.source>1.8</maven.compiler.source>
            <maven.compiler.target>1.8</maven.compiler.target>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
            <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    
            <vaadin.version>14.1.25</vaadin.version>
        </properties>
    

    正如您的 sn-p 中的注释所说,您可以直接将 ${vaadin.version} 的引用替换为值(如 &lt;version&gt;14.1.25&lt;/version&gt;)或使用 &lt;properties&gt;,如上所示。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-11-30
      • 1970-01-01
      • 2021-07-09
      • 1970-01-01
      • 2017-03-19
      • 2018-10-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多