simple-robot / simpler-robot

Simple Robot,一个bot风格的Kotlin多平台事件调度框架,异步高效、Java友好!/ A Bot-style Kotlin Multiplatform event scheduling framework, asynchronous and high-performance, java-friendly! 🐱😼😻😸
https://simbot.forte.love
GNU Lesser General Public License v3.0
512 stars 44 forks source link

扫描不到bot配置文件 #488

Closed Chowhound-ch closed 1 year ago

Chowhound-ch commented 1 year ago

版本号

v3.0.0-M1

附加版本

simbot-component-mirai-boot:v3.0.0.0-beta.2

问题描述

不管是simbot默认扫描还是yml里配置过simbot包扫描路径都扫描不到resources/simbot-bots/default.bot文件,控制台日志: image

而将simbot-component-mirai-boot换成v3.0.0.0-beta.2则可正常注册bot,控制台日志: image

复现方式

使用simbot-component-mirai-boot的v3.0.0.0-beta.2版本

相关日志

.   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v2.7.1)

2022-10-30 13:07:14.633  INFO 39976 --- [           main] per.zsck.simbot.ZcBotApplicationKt       : Starting ZcBotApplicationKt using Java 1.8.0_332 on LAPTOP-SO8EL57U with PID 39976 (G:\MyProject\spring\zc-bot\target\classes started by 1 in G:\MyProject\spring\zc-bot)
2022-10-30 13:07:14.635  INFO 39976 --- [           main] per.zsck.simbot.ZcBotApplicationKt       : The following 1 profile is active: "data"
2022-10-30 13:07:15.361  WARN 39976 --- [           main] o.m.s.mapper.ClassPathMapperScanner      : No MyBatis mapper was found in '[per.zsck.simbot]' package. Please check your configuration.
2022-10-30 13:07:15.722  WARN 39976 --- [ispatcherThread] .s.b.StandardBotVerifyInfoDecoderFactory : Unable to find the com.charleskorn.kaml:kaml in current classpath, the bot configuration parser in *.bot.yaml format will not be available.
2022-10-30 13:07:15.723  WARN 39976 --- [ispatcherThread] .s.b.StandardBotVerifyInfoDecoderFactory : Unable to find the kotlinx-serialization-properties in current classpath, the bot configuration parser in *.bot.properties format will not be available.
2022-10-30 13:07:15.732  INFO 39976 --- [ispatcherThread] otEventProviderAutoInstallBuildConfigure : The number of Installable Event Provider Factory is 0
2022-10-30 13:07:15.733  INFO 39976 --- [ispatcherThread] otEventProviderAutoInstallBuildConfigure : Install Event Providers by [installAllEventProviders]
2022-10-30 13:07:15.754  INFO 39976 --- [ispatcherThread] s.a.a.SpringBootApplicationConfiguration : The size of providers built is 0
2022-10-30 13:07:15.761  INFO 39976 --- [ispatcherThread] l.f.s.c.a.B.BotRegistrarImpl             : Registering bot with verify info [love.forte.simbot.bot.PathBotVerifyInfo@4b6d33c6]
2022-10-30 13:07:15.761  WARN 39976 --- [ispatcherThread] s.a.a.SpringBootApplicationConfiguration : Bot verify info [love.forte.simbot.bot.PathBotVerifyInfo@4b6d33c6] not registered by any registrars, skip. The botRegistrar: BotRegistrarImpl(providers=[])
2022-10-30 13:07:15.761  INFO 39976 --- [ispatcherThread] s.a.a.SpringBootApplicationConfiguration : Bots all registered. The size of bots: 0
2022-10-30 13:07:15.767  INFO 39976 --- [ispatcherThread] s.a.a.SpringBootApplicationConfiguration : Simbot Spring Boot Application built in 47.986800ms
2022-10-30 13:07:15.843  INFO 39976 --- [           main] c.a.d.s.b.a.DruidDataSourceAutoConfigure : Init DruidDataSource
2022-10-30 13:07:16.304  INFO 39976 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} inited
Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter.
Property 'mapperLocations' was not specified.
 _ _   |_  _ _|_. ___ _ |    _ 
| | |\/|_)(_| | |_\  |_)||_|_\ 
     /               |         
                        3.5.2 
2022-10-30 13:07:17.329  INFO 39976 --- [           main] per.zsck.simbot.ZcBotApplicationKt       : Started ZcBotApplicationKt in 3.044 seconds (JVM running for 4.171)
2022-10-30 13:07:17.332  INFO 39976 --- [ionShutdownHook] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closing ...
2022-10-30 13:07:17.335  INFO 39976 --- [ionShutdownHook] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closed
Disconnected from the target VM, address: '127.0.0.1:59375', transport: 'socket'

Process finished with exit code 0

其他补充

No response

ForteScarlet commented 1 year ago

那用 simbot-component-mirai-boot的v3.0.0.0-beta.2 到底是行还是不行

以及提供详细的依赖配置文件,比如 pom.xml

Chowhound-ch commented 1 year ago

v3.0.0.0-beta.2不行(复制忘改了,下面想说v3.0.0.0-beta.1可以正常注册bot来着) yml: image 目录结构: image pom.xml: image image image

只将simbot-component-mirai-boot从v3.0.0.0-beta.2改到v3.0.0.0-beta.1就能正常注册bot

ForteScarlet commented 1 year ago

问题未复现,尝试:

Chowhound-ch commented 1 year ago

感谢提供思路,问题解决 导入simbot-component-mirai-boot的v3.0.0.0-beta.2时未正常引入simbot-component-mirai-core maven依赖中无法找到且找不到对应jar包 image image 下为导入v3.0.0.0-beta.1时正常运行的情况 image image

手动导入simbot-component-mirai-core的v3.0.0.0-beta.2即可正常运行

ForteScarlet commented 1 year ago

simbot-component-mirai-boot 中是存在对 simbot-component-mirai-core 的引用的 (参考),可能只是maven没成功下载此依赖导致的。不过直接使用 -core 就可以了,组件依赖的引用已经不再需要使用 -boot 了。