GradleException 无法创建 ZIP

标签 gradle build.gradle

原因:org.gradle.api.GradleException:无法创建ZIP'/jenkins/repository/workspace/profile/build/libs/../profile.jar'.

Project
    common  << I build under this directory
    profile

build.gradle(in common)
    ...
    dependencies {
    compile project(':../profile')
    ...

settings.gradle(in common)
    include '../profile'

它适用于Windows环境。但即使使用 root 帐户,它也无法在 linux 环境下工作

最佳答案

includeproject 方法接受的项目路径是逻辑路径,而不是物理路径。它们不能包含 ..。物理路径必须在 settings.gradle 中单独声明(如果它们从逻辑路径转移)。声明平面物理目录布局的最简单方法是使用 includeFlat 方法:

通用/settings.gradle

includeFlat 'profile'

通用/build.gradle

dependencies {
    compile project(':profile')
}

您可以在 Gradle User Guide 的“多项目构建”一章中找到有关此主题的更多信息。 .

关于GradleException 无法创建 ZIP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16786818/

相关文章:

git - 每个git分支的IntelliJ运行配置

gradle - 从 Gradle Jmeter 插件以非 GUI 模式运行 Jmeter

android - Gradle : adding assets folder dynamically

build.gradle - 如何修复模块 class.jar 中发现的此错误重复类

android - 在 intellij 16 中创建 Android 应用程序时 Gradle 同步失败

gradle - 是否可以使用 Artifactory 提供顶级构建脚本依赖项?

java - 无法使用 gradle 和 jdk 11 构建 jar

android - 新依赖 React native - gradle clean - 无法解析所有依赖

android - 任务 ':app:transformClassesWithPreJackPackagedLibrariesForArmv7aDebug' 执行失败

android-studio - 运行 react-native run-android 时无法提取 textlayoutbuilder-1.0.0.aa