首页 > 解决方案 > 如何在 spring-boot 项目中向 pom.xml 添加非 spring-boot 依赖项

问题描述

我有一个Spring Boot项目,我想在那里使用对ModelMaker

    <dependency>
        <groupId>org.modelmapper</groupId>
        <artifactId>modelmapper</artifactId>
        <version>2.3.6</version>
    </dependency>

如果我添加它,我会收到错误消息:

Save could not be completed. Try File > Save As... if the problem persists.

Reason:
Could not write file pom.xml

details:
Could not write file: D:\...\pom.xml.
D:\...\pom.xml (The requested operation cannot be performed on a file with a user-mapped section open)

ModelMapper不属于标准启动器Spring Boot,因此我无法pom.xml通过 Spring>Edit Starters添加它

如何添加非入门依赖项?

标签: javaspringeclipsespring-bootmaven

解决方案


今天我发现了同样的问题。

如果您使用 IntelliJ,只需右键单击 pom.xml,然后单击 Maven,然后重新导入。


推荐阅读