java Gradle插件依赖关系存在,但在构建期间未找到

weylhg0b  于 2022-10-30  发布在  Java
关注(0)|答案(3)|浏览(235)

看起来我所拥有的是正确的,但Gradle仍然没有找到插件。
我的插件子句看起来像:

plugins {
    id "io.codearte.nexus-staging" version "0.8.0"
}

生成错误如下所示:

FAILURE: Build failed with an exception.

* Where:

Build file '/home/local/MAGICLEAP/doprea/development/java/JenkinsPipelineUnit-1.1/build.gradle' line: 4

* What went wrong:

Plugin [id: 'io.codearte.nexus-staging', version: '0.8.0'] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'io.codearte.nexus-staging:io.codearte.nexus-staging.gradle.plugin:0.8.0')
  Searched in the following repositories:
    Gradle Central Plugin Repository

然而,CR似乎有:
https://plugins.gradle.org/plugin/io.codearte.nexus-staging/0.8.0的最大值
......和依赖性子句,前提是那里与我已经拥有的相同。
我错过了什么吗?

xdnvmnnf

xdnvmnnf1#

插件页面说明了包含插件的两种方式(https://plugins.gradle.org/plugin/io.codearte.nexus-staging#new-plugin-mechanism-info)。一种是for plugins DSL for Gradle 2.1,另一种是for use in older Gradle versions or where dynamic configuration is required。Gradle插件DSL版本有一些限制,在任何情况下都不起作用,例如:
1.只能在生成脚本中使用。
1.不能与子项目{}、所有项目{}等一起使用。

  1. plugins {}块也必须是buildscript中的顶级语句
    如果插件DSL版本不适用,您应该使用其他方法将其包含在内。
s3fp2yjn

s3fp2yjn2#

正在添加
根项目.构建文件名= 'build.gradle.kts'
在settings.gradle文件中的第一行应该会对您有所帮助。
@参考:reference link

vohkndzv

vohkndzv3#

includeBuild('../node_modules/react-native-gradle-plugin')
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
include(":ReactAndroid")
project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid')
include(":ReactAndroid:hermes-engine")
project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine')
}

添加此代码android/settings.gradle

相关问题