我正在尝试在Jenkins上部署我们的项目,但是每个组件都只是使用根目录中的settings.gradle文件,即使我为每个组件添加了单独的settings.gradle文件也是如此。
目前,我有这样的结构。
我在settings.gradle文件的根目录和船目录中都有
include("ui:shipnotice")
。我有一个名为copy的任务,当我尝试在ship文件夹下调用此任务时,我需要使用../../graldew --no-daemon --info copy
我得到以下
Settings evaluated using settings file 'xxx/ui/shipnotice/settings.gradle.kts'.
但是,在使用Jenkins部署之后,事情变得很奇怪。在Jenkins中,它继续使用根目录中的settings.gradle文件。Settings evaluated using settings file '/home/jenkins/workspace/xxx/settings.gradle.kts'.
FAILURE: Build failed with an exception.
* What went wrong:
Project directory '/home/jenkins/workspace/xxx/ui/shipnotice' is not part of the build defined by settings file '/home/jenkins/workspace/xxx/settings.gradle.kts'. If this is an unrelated build, it must have its own settings file.
我试图添加rootProject.name = "shipnotice" include("ui:shipnotice")
以使shipnotice成为根项目,但是它仍然使用来自根的文件。任何人都可以给我一些有关此错误的想法吗?提前致谢!
最佳答案
我建议您摆脱嵌套的settings.gradle
。这是not a recommended setup。
Jenkins构建中最有可能发生的事情是,执行Gradle命令的文件夹是结帐的根文件夹。因此,从该根目录中提取了settings.gradle
。
关于jenkins - Jenkins 上的Gradle怪异错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64022742/