Reputation: 876
Caused by: org.gradle.api.GradleException:
Could not create 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'
It works on windows environment. But it does not work on linux
environment even using root
account
Upvotes: 2
Views: 4305
Reputation: 744
An even shorter way to fix this: Add the following line to the build.gradle
file of the included profile project:
archivesBaseName = 'profile'
This overwrites the default name of the jar.
Upvotes: 0
Reputation: 775
Another common issue that can happen here especially if you're using windows is you could have opened the previous jar up in 7zip or some other tool and that's causing the file to be locked. To test this try to delete the jar that's sitting in build/libs if you can't delete the file it's locked by another program more than likely. :D
Upvotes: 2
Reputation: 123910
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.
Upvotes: 2