gpt4 book ai didi

java - Gradle 复合构建。未找到项目。 includeBuild 不起作用?

转载 作者:太空宇宙 更新时间:2023-11-04 09:04:03 27 4
gpt4 key购买 nike

我有 2 个项目,my-app 和 string-utils。 My-app 依赖于 string-utils。构建 my-app 时我得到:

"Project with path ':string-utils' could not be found in root project 'my-app'

includeBuild 不应该在这里工作吗?

我的 Gradle 扫描是 here .

├── my-app
│   ├── build
│   ├── build.gradle
│   ├── settings.gradle
│   └── src
└── string-utils
├── build
├── build.gradle
├── settings.gradle
└── src

/my-app/settings.gradle:

rootProject.name = 'my-app'
includeBuild '../string-utils'

/my-app/build.gradle:

plugins {
id 'java'
id 'application'
id 'idea'
}
group "org.sample"
version "1.0"
application {
mainClassName = "org.sample.myapp.Main"
}
dependencies {
implementation project(':string-utils')
}
repositories {
jcenter()
}

/string-utils/settings.gradle:

rootProject.name = 'string-utils'

运行时:

/my-app$ gradle build --scan --info

Initialized native services in: /home/andrew/.gradle/native
The client will now receive all logging from the daemon (pid: 202204). The daemon log file: /home/andrew/.gradle/daemon/6.2.1/daemon-202204.out.log
Starting 4th build in daemon [uptime: 38 mins 14.32 secs, performance: 99%, non-heap usage: 20% of 268.4 MB]
Using 128 worker leases.
Starting Build
Compiling settings file '/tmp/5/my-app/settings.gradle' using BuildScriptTransformer.
Settings evaluated using settings file '/tmp/5/my-app/settings.gradle'.
Projects loaded. Root project using build file '/tmp/5/my-app/build.gradle'.
Included projects: [root project 'my-app']
[composite-build] Configuring build: /tmp/5/string-utils

Configure project :string-utils
Evaluating project ':string-utils' using build file '/tmp/5/string-utils/build.gradle'.
Registering project ':string-utils' in composite build. Will substitute for module ':string-utils'.

Configure project :
Evaluating root project 'my-app' using build file '/tmp/5/my-app/build.gradle'.
Compiling build file '/tmp/5/my-app/build.gradle' using SubsetScriptTransformer.
Compiling build file '/tmp/5/my-app/build.gradle' using BuildScriptTransformer.

FAILURE: Build failed with an exception.

* Where:
Build file '/tmp/5/my-app/build.gradle' line: 19

* What went wrong:
A problem occurred evaluating root project 'my-app'.

Project with path ':string-utils' could not be found in root project 'my-app'.

最佳答案

已修复。需要更换

implementation project(':string-utils')

implementation "org.sample:string-utils"

关于java - Gradle 复合构建。未找到项目。 includeBuild 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60439419/

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