【发布时间】:2021-07-02 20:00:43
【问题描述】:
我在 Lombok 的多模块 maven 项目中使用 mapstruct。根据官方文档设置 pom 后,mapstruct 确实正确生成了映射器实现。但是会在顶层模块中生成一个额外的文件夹。
父 pom.xml:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
<compilerArgument>-Xlint:deprecation</compilerArgument>
<showWarnings>true</showWarnings>
<compilerArgs>
<arg>-parameters</arg>
</compilerArgs>
</configuration>
</plugin>
基于网络的 pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.16</version>
</path>
<!-- additional annotation processor required as of Lombok
1.18.16 -->
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</path>
</annotationProcessorPaths>
<showWarnings>true</showWarnings>
<compilerArgs>
<arg>
-Amapstruct.suppressGeneratorTimestamp=true
</arg>
<arg>
-Amapstruct.suppressGeneratorVersionInfoComment=true
</arg>
<arg>
-Amapstruct.verbose=true
</arg>
</compilerArgs>
</configuration>
</plugin>
web-base 是我使用 mapstruct 的模块,而 src/main/resource... 是我不想要的生成文件夹。 如何将此位置更改为它自己的模块而不是顶部模块? 谢谢。
【问题讨论】:
标签: spring-boot maven mapstruct