2

原因: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环境。但即使使用帐户,它也不适用于linux环境root

4

3 回答 3

2

The project paths accepted by the include and project methods are logical paths, not physical paths. They cannot contain a ... Physical paths must be declared separately in settings.gradle (if they divert from the logical path). The easiest way to declare a flat physical directory layout is to use the includeFlat method:

common/settings.gradle

includeFlat 'profile'

common/build.gradle

dependencies {
    compile project(':profile')
}

You can find more information on this topic in the "multi-project builds" chapter of the Gradle User Guide.

于 2013-05-28T08:27:04.740 回答
2

这里可能发生的另一个常见问题,尤其是在您使用 Windows 时,您可能已经用 7zip 或其他工具打开了以前的 jar,这会导致文件被锁定。为了测试这一点,如果您无法删除它很可能被另一个程序锁定的文件,请尝试删除位于 build/libs 中的 jar。:D

于 2015-09-20T10:39:08.217 回答
0

解决此问题的更短方法:将以下行添加到build.gradle包含的配置文件项目的文件中:

archivesBaseName = 'profile'

这会覆盖 jar 的默认名称。

于 2016-06-17T15:13:53.947 回答