Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jdk 模块性 强依赖fastjson #2797

Closed
JinlongLiao opened this issue Jul 10, 2024 · 6 comments · Fixed by #2802
Closed

jdk 模块性 强依赖fastjson #2797

JinlongLiao opened this issue Jul 10, 2024 · 6 comments · Fixed by #2802
Labels
bug Something isn't working

Comments

@JinlongLiao
Copy link

问题描述

简要描述您碰到的问题。

Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
module not found: fastjson

    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1309)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:215)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:903)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:280)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:203)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:255)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:201)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:361)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:314)

环境信息

请填写以下信息:

  • OS信息: windows11
  • JDK信息:jdk17 maven 3.9.8
  • 版本信息:fastjson2.0.51

重现步骤

项目中使用 module-info.java 仅使用fastjson2 不依赖fastjson1
image

//可在此输入示例代码

期待的正确结果

对您期望发生的结果进行清晰简洁的描述。

相关日志输出

请复制并粘贴任何相关的日志输出。

附加信息

如果你还有其他需要提供的信息,可以在这里填写(可以提供截图、视频等)。

@JinlongLiao JinlongLiao added the bug Something isn't working label Jul 10, 2024
@wenshao wenshao added this to the 2.0.52 milestone Jul 10, 2024
@wenshao
Copy link
Member

wenshao commented Jul 11, 2024

这个问题修复过,帮忙用2.0.51再验证下

@wenshao wenshao removed this from the 2.0.52 milestone Jul 11, 2024
@galaxy-sea
Copy link
Contributor

@wenshao feign#2474也有相同问题,2.0.51版本也是强制依赖fastjson模块。
我看 fastjson#2451了讨论有点不明所以🤣

@wenshao
Copy link
Member

wenshao commented Jul 12, 2024

奇怪了,我在moditect/module-info.java上配置的是

requires transitive fastjson;

不知道为什么生成的是

requires fastjson;

@galaxy-sea
Copy link
Contributor

fastjson#2722也存在相同问题

@leifenghai
Copy link

transitive 是传递依赖
requires static 才是在运行时可选的

@galaxy-sea
Copy link
Contributor

image
hi @leifenghai , 不知道为什么编译之后transitive static关键字都会消失🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants