找不到多模块项目的方法compile()(Could not find method compile() for a multi module project)

编程入门 行业动态 更新时间:2024-10-17 15:25:10
找不到多模块项目的方法compile()(Could not find method compile() for a multi module project) dependencies { compile project('client') compile project('-cache ')

现在,当我注释掉compile project('product-cache-client')它会转到下一个并且对此有所了解。

我试图将它添加到该模块中的gradle.settings中,如下所示:

include('client') include('cache')

但我仍然得到同样的错误。 我甚至尝试将其添加到gradle.settings

project('lib/cache').projectDir = "$rootDir/lib/cache" as File

并且仍然得到相同的结果。

Gradle 4.4

主gradle.build文件:

subprojects { dependencies { compile project('client') compile project('cache') } repositories{ jcenter() mavenCentral() } } configure(subprojects){ apply plugin: 'maven' apply plugin: 'java' apply plugin: 'idea' apply plugin: 'eclipse' } repositories { } buildscript { ext { sourceCompatibility = 1.8 targetCompatibility = 1.8 } } dependencies { jcenter() mavenCentral() } dependencies { compile project('client') compile project('-cache ')

Now when I comment out compile project('product-cache-client') it moves to the next one and compains about that.

I tried to add it to gradle.settings in that module like so:

include('client') include('cache')

But I still get the same error. I even tried adding this to the gradle.settings

project('lib/cache').projectDir = "$rootDir/lib/cache" as File

And still get the same result.

Gradle 4.4

main gradle.build file:

subprojects { dependencies { compile project('client') compile project('cache') } repositories{ jcenter() mavenCentral() } } configure(subprojects){ apply plugin: 'maven' apply plugin: 'java' apply plugin: 'idea' apply plugin: 'eclipse' } repositories { } buildscript { ext { sourceCompatibility = 1.8 targetCompatibility = 1.8 } } dependencies { jcenter() mavenCentral() }

最满意答案

在你的父级构建的顶部添加java插件,对我来说这是可行的:

应用插件:'java'

这里推荐 - 第二个答案找不到方法compile()用于参数Gradle并且还用'repositories'切换'依赖关系' - 至少在你编写的build.gradle的示例中,它们被切换。

Add the java plugin on top of your parent build, for me this works:

apply plugin:'java'

It is recommended here - the second answer Could not find method compile() for arguments Gradle And also switch the 'dependencies' with 'repositories' - at least in the sample of build.gradle you wrote here they are switched.

更多推荐

本文发布于:2023-04-28 01:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1329729.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:找不到   多模   方法   项目   compile

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!