gpt4 book ai didi

gradle - Gradle插件依赖项(NoClassDefFoundError)

转载 作者:行者123 更新时间:2023-12-03 06:01:55 25 4
gpt4 key购买 nike

我正在尝试编写gradle插件,它依赖于RPM星云插件(基本上将其包装)。我编译插件没有任何问题。在生成的ivy.xml中,我有

  <dependencies>
<dependency org="com.netflix.nebula" name="gradle-ospackage-plugin" rev="4.1.0" conf="compile-&gt;default"/>
</dependencies>

感觉还可以,但是当我在应用程序中应用插件时,我得到了
Caused by: java.lang.NoClassDefFoundError: com/netflix/gradle/plugins/rpm/RpmPlugin
at com.cisco.td.gradle.rpm.ServiceRpmPlugin$_configureProject_closure2.doCall(ServiceRpmPlugin.groovy:27)
at com.cisco.td.gradle.rpm.ServiceRpmPlugin.configureProject(ServiceRpmPlugin.groovy:26)

执行本节代码时
    project.plugins.with {
apply RpmPlugin
}

我试图使用我的插件类在构建类路径上添加依赖项
    project.buildscript.dependencies {
classpath "com.netflix.nebula:gradle-ospackage-plugin:4.1.0"
}

但这引发:
Caused by: org.gradle.api.InvalidUserDataException: Cannot change dependencies of configuration ':classpath' after it has been resolved.
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.validateMutation(DefaultConfiguration.java:631)
at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$2.run(DefaultConfiguration.java:174)
at org.gradle.api.internal.DefaultDomainObjectCollection.assertMutable(DefaultDomainObjectCollection.java:274)

当我将星云依赖项作为buildscript依赖项直接添加到应用程序项目中时,它会起作用,但这不是我认为的工作方式-插件应下载其所有依赖项,而客户端则无需关心...

提前致谢!

最佳答案

几个小时后-问题是没有生成pom.xml。使用时创建

uploadArchives {
repositories {
mavenDeployer {
repository(url: mavenLocal().url)
}
}
}

它按预期工作...

关于gradle - Gradle插件依赖项(NoClassDefFoundError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41138028/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com