如何更改由MapStruct生成的类的位置? [英] How to change the location of classes generated by MapStruct?

查看:1064
本文介绍了如何更改由MapStruct生成的类的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用MapStruct来生成JAXB类和我的域类之间的映射。
我使用MapStruct官方站点中描述的gradle插件。在编译过程中,类将在build / generated / sources / apt / main中生成。
如何更改此位置?我无法找到gradle的任何指南,虽然有一个编译器标志可以通过ant脚本来更改它,但不幸的是它不适用于gradle
任何帮助表示赞赏。

I am using MapStruct to generate the mapping between the JAXB classes and my domain classes. I am using gradle plugin as described in MapStruct official site. During the compilation process, the classes are generated in "build/generated/sources/apt/main". How can i change this location? I am not able to find any guide for gradle though there is a compiler flag to change it through ant script, but unfortunately it is not working for gradle Any help is appreciated.

推荐答案

这不是链接到MapStruct,而是与gradle apt插件的工作方式以及它如何告知Java编译器放置生成的源文件。

This is not linked to MapStruct, but to the way the gradle apt plugin works and how it tells the Java compiler to place the generated sources.

根据配置配置插件的生成源文件文档。我们需要扩展compile的 aptOptions 。控制生成目标的属性是 generatedSourcesDestinationDir

To configure the generated sources of the plugin according to the configuration documentation. One needs to extend the aptOptions of the compile. The property controlling the destination of the generated is generatedSourcesDestinationDir

这篇关于如何更改由MapStruct生成的类的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆