我正在尝试使用库中的AspectJ Annotation,并将其拉入我的项目。我的项目使用Gradle,因此我尝试使用FreeFair AspectJ Gradle Plugin。
我需要能够将AspectJ *-aspectpath * 参数设置为Gradle正在拉入的库依赖项。
FreeFair,似乎没有太多的Documentation,主要只是Sample Code。
在他们的示例代码中,我看到我可以使用它来将 *-aspectpath * 设置为一个本地"项目":
aspect project(":aspectj:aspect")
有人知道如何将 *-aspectpath * 设置为外部库依赖项吗?
我创建了一个示例项目,并将其放在GitHub上:freefair-aspectpath-external-library.
- 注意:* 我使用的是 * io. freefair. gradle:aspectj-plugin * 版本2.9.5,因为我的项目无法使用Gradle版本4.10.3。
- 更新:**我已经为此创建了一个错误:https://github.com/freefair/gradle-plugins/issues/46
2条答案
按热度按时间ijxebb2r1#
感谢@larsgrefer,他在GitHub问题(46)中提供了答案。
对于 io.freefair.aspectj.compile-time-weaving 插件2.9.5,配置被命名为“aspects”而不是“aspect”。
以下操作修复了该问题:
完整的构建文件如下所示:
pxiryf3j2#
aspect
是一种普通的老式gradle配置。这意味着您可以使用这里描述的所有表示法: