mirror of
https://github.com/xiaozhou233/JuiceAgent.git
synced 2026-12-05 13:05:53 +08:00
- docs/update: add v5.0.0 release notes (bilingual) covering the v1 -> v2 breaking config change, migration steps and the BuiltIn / CustomJar modes - docs/update: add CHANGELOG starting from v4.1.2
6.2 KiB
6.2 KiB
JuiceAgent 5.0.0 Release Notes
中文
⚠️ 破坏性变更
- 配置文件升级到 v2:
CONFIG_VERSION提升为2。加载器启动时会校验JuiceAgent.Version,版本不匹配将直接拒绝加载,因此旧版 v1 配置必须先迁移。
v1(不再支持):
[JuiceAgent]
Version = 1
[JuiceAgent.Loader]
JuiceAgentNativeLibraryPath = ""
[JuiceAgent.Modules]
[JuiceAgent.Modules.JarLoader]
Enabled = true
InjectionDir = "./injection"
JarPath = "./MyCustomJar.jar"
EntryClass = "Example.Main"
EntryMethod = "run"
v2(当前):
[JuiceAgent]
Version = 2
JuiceAgentNativeLibraryPath = ""
[JarLoader]
Enabled = true
Mode = "BuiltIn"
InjectionDir = "./injection"
JarPath = "./MyCustomJar.jar"
EntryClass = "Example.Main"
EntryMethod = "run"
迁移要点:
Version由1改为2。JuiceAgentNativeLibraryPath由[JuiceAgent.Loader]移到[JuiceAgent]。- 原
[JuiceAgent.Modules.JarLoader]展平为顶层[JarLoader]。 - 新增必填项
Mode(BuiltIn或CustomJar)。 - 完整说明见 docs/config.md。
✨ 新功能
- 新增两种 JAR 加载模式(
JarLoader.Mode):BuiltIn(推荐):加载器解出内嵌的 JuiceAgent-API jar 并注入系统类加载器,agent 通过 API 引导,再由 JarLoader 模块加载目标 JAR 并调用入口方法。CustomJar:不再使用 JuiceAgent-API,加载器直接把JarPath加入系统类加载器并调用EntryClass.EntryMethod,便于接入自定义引导。
- 新增
JarLoader.Enabled开关(默认false),可在BuiltIn模式下关闭 JarLoader 模块。 - 新增配置解析与访问的错误日志:配置缺失或类型不匹配时会给出明确提示。
🐛 修复
- 修复自定义 JAR 入口类查找失败:将类名规范化为 JNI 内部形式(
.→/),FindClass现在能正确解析Example.Main这类 Java 二进制名(修复NoClassDefFoundError)。 - 修复集成测试的二进制拷贝脚本
tests/copy-bin.bat:改用原生COPY /Y,在目标文件被占用时明确报错,不再静默失败导致测试使用旧二进制。 - 修复
GetClassBytesByName集成测试:先加载目标类再按名获取字节码(该 API 只解析已加载的类)。
🔧 内部改动
- TOML 解析器由
toml11迁移到toml++。 - 移除未使用的
LoaderConfig/get_loader_config/print_loader_config(其中仍引用着 v1 的配置键)。
📝 文档
- 新增 docs/config.md:完整的 v2 配置参考(含两种模式流程与各键默认值)。
- 重写 docs/advanced.md:改为描述
JarLoader.Mode = "CustomJar",移除已废弃的JUICEAGENT_API_*环境变量说明。 - README(中/英)的 Quick Start 配置示例升级到 v2 并链接
docs/config.md;示例列表补充inject-via-java-api。 - 同步更新
examples/inject-via-java-api的说明文档(中/英,md/txt)。
English
⚠️ Breaking Changes
- Configuration upgraded to v2:
CONFIG_VERSIONis now2. The loader validatesJuiceAgent.Versionat startup and refuses to load on a mismatch, so existing v1 configs must be migrated first.
v1 (no longer supported):
[JuiceAgent]
Version = 1
[JuiceAgent.Loader]
JuiceAgentNativeLibraryPath = ""
[JuiceAgent.Modules]
[JuiceAgent.Modules.JarLoader]
Enabled = true
InjectionDir = "./injection"
JarPath = "./MyCustomJar.jar"
EntryClass = "Example.Main"
EntryMethod = "run"
v2 (current):
[JuiceAgent]
Version = 2
JuiceAgentNativeLibraryPath = ""
[JarLoader]
Enabled = true
Mode = "BuiltIn"
InjectionDir = "./injection"
JarPath = "./MyCustomJar.jar"
EntryClass = "Example.Main"
EntryMethod = "run"
Migration:
Version:1→2.JuiceAgentNativeLibraryPathmoved from[JuiceAgent.Loader]to[JuiceAgent].[JuiceAgent.Modules.JarLoader]flattened to a top-level[JarLoader].- New required key
Mode(BuiltInorCustomJar). - Full reference: docs/config.md.
✨ Features
- Two JAR loading modes (
JarLoader.Mode):BuiltIn(recommended): the loader extracts the embedded JuiceAgent-API jar and adds it to the system class loader, the agent bootstraps it, and the JarLoader module loads the target JAR and invokes its entry method.CustomJar: JuiceAgent-API is not used; the loader addsJarPathto the system class loader and invokesEntryClass.EntryMethod, so you can plug in your own bootstrap.
- New
JarLoader.Enabledswitch (defaultfalse) to turn the JarLoader module off inBuiltInmode. - New logging for config parse and access errors, with clear messages when a key is missing or has the wrong type.
🐛 Fixes
- Fix entry class lookup for custom jars: class names are normalized to the JNI internal form (
.→/) soFindClassresolves Java binary names likeExample.Main(fixesNoClassDefFoundError). - Fix the integration test helper
tests/copy-bin.bat: it now uses nativeCOPY /Yand reports a clear error when a target file is locked, instead of failing silently and testing against stale binaries. - Fix the
GetClassBytesByNameintegration test: load the target class before looking it up by name (the API only resolves already-loaded classes).
🔧 Internal
- Migrate the TOML parser from
toml11totoml++. - Remove the unused
LoaderConfig/get_loader_config/print_loader_config(which still referenced a v1 config key).
📝 Docs
- Add docs/config.md: the complete v2 configuration reference (mode workflows and key defaults).
- Rewrite docs/advanced.md around
JarLoader.Mode = "CustomJar", dropping the removedJUICEAGENT_API_*environment variables. - Update the Quick Start config example in both READMEs to v2 and link
docs/config.md; addinject-via-java-apito the examples list. - Update the
examples/inject-via-java-apiguides (EN/ZH, md/txt).
如果您在使用过程中遇到问题,可以加入我们的QQ/Discord群组 If you encounter any issues during use, you can join our QQ/Discord group
Discord: JuiceDev QQ群: 1103504356
Full Changelog: https://github.com/xiaozhou233/JuiceAgent/compare/v4.1.2...v5.0.0