gradle - 如何将源代码文件添加为源文件中的构建依赖项和/或访问定义?
问题描述
我有:
plugins {
id 'java'
id 'net.bytebuddy.byte-buddy-gradle-plugin' version "$byteBuddyVersion"
}
byteBuddy {
transformation {
plugin = io.github.leoframework.testing.Logger.class
}
}
Logger.java
是项目的一部分,在 Byte Buddy 插件中。我需要在我的构建脚本中引用哪个文件/类来调用插件。编译后需要加载类文件Logger.java
。
解决方案
If it's part of the current project, it is not that trivial, unfortunately. Gradle is executed in its own JVM process that is run before the compilation what makes this somewhat a chicken and egg problem.
To overcome this, you'd need to compile the classes first, then define a subproject that depend on these classes dynamically and then execute the plugin from this subproject once the dependent classes are available.
推荐阅读
- javascript - 如何使用 cypress test 登录微软帐户
- php - 如何验证yii2中的特定字段
- css - 将 CSS 放入文档中的最佳和最快的方法是什么?
- android - 停止 BottomNavigationView 重新创建片段
- prototype - 滚动时,如何使元素仅固定在 Figma 的特定部分中?
- visual-studio-code - 将变量 TM_FILENAME_BASE 分成两部分用于 VScode 的片段
- r - 如何根据日期组的最新日期过滤数据?
- postgresql - 从表 A 中获取所有记录,而不是从表 B 中为空
- npm - 在 NPM 模块中导出 Sass
- python-3.x - 解析 SEC 表格数据