有没有一种方法可以 运行 使用 MapStruct 的程序,而无需每次都进行 maven 全新安装?

Is there a way to run programs using MapStruct without doing a maven clean install each time?

Mapstruct 在完成 mvn clean install 后生成一个 class,但如果没有完成,我 运行 我的 spring 启动应用程序我得到一个 class未发现异常。我想知道我是否可以对我的 Eclipse 做任何事情或在我的 pom.xml 文件中添加一些东西(它是多个项目,所以我需要先对每个项目做 mvn clean install)以便 Mapstruct 生成 class 当我只是 运行 我的程序正常时

为了让 IDE 生成 类,您需要对其进行设置。

您可以阅读有关 MapStruct 的 Eclipse 集成的更多信息 here

简而言之,您需要为 Eclipse 安装 m2e-apt 插件,它会自动获取并应用注释处理器设置。

您还需要在 pom.xml

<properties> 中添加以下内容
<!-- automatically run annotation processors within the incremental compilation -->
<m2e.apt.activation>jdt_apt</m2e.apt.activation>