[halo-dev/halo]插件构建失败

2024-03-18 69 views
4

在控制台使用 ./gradlew build 命令时,出现以下报错

image

project structure:

image

gradle:

image

javac

image Relevant log output
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'plugin-starter'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve io.github.guqing.plugin:gradle-plugin-halo:0.0.6-SNAPSHOT.
     Required by:
         project : > io.github.guqing.plugin-development:io.github.guqing.plugin-development.gradle.plugin:0.0.6-SNAPSHOT:20221129.041856-6
      > No matching variant of io.github.guqing.plugin:gradle-plugin-halo:0.0.6-SNAPSHOT:20221129.041856-11 was found. The consumer was configured to find a runtime of a library compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '7.4' but:
          - Variant 'apiElements' capability io.github.guqing.plugin:gradle-plugin-halo:0.0.6-SNAPSHOT declares a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares an API of a component compatible with Java 17 and the consumer needed a runtime of a component compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.4')
          - Variant 'runtimeElements' capability io.github.guqing.plugin:gradle-plugin-halo:0.0.6-SNAPSHOT declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 17 and the consumer needed a component compatible with Java 8
              - Other compatible attribute:
                  - Doesn't say anything about org.gradle.plugin.api-version (required '7.4')

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
Additional information

当我使用直接在md中点击 ./gradlew pnpmInstall 时,可以正常跑起来

image

但是放在 terminal中即报上述错误

希望得到大佬的解答

回答

3

PS :halo 本体的代码 运行 build命令也是报出上述错误

2

看起来像是 JDK 版本问题。 在 IDE 里点击操作,使用的是项目配置的 JDK 17;而在 terminal 里敲命令,使用的是系统环境变量配置的 JDK,可能会是其他版本。

0

建议在 Terminal 中执行 java -version 命令,看看具体的结果是什么。

3

是的,在terminal里面敲命令确实是jdk8,而项目里面设置的是jdk17。 如果想使用./gradlew bootRun --args="--spring.profiles.active=dev" 启动,那么必须切换环境, 我注意到页面右侧有gradle插件,点击什么能和./gradlew bootRun --args="--spring.profiles.active=dev" 命令一致呢?

1

我还没有配置,谢谢您的提醒

8

插件已经运行起来了,谢谢各位大佬的提点