I have a multi project build with 2 modules.
root
- myWebApp
- distribution
myWebApp uses the ‘war’ plugin and creates a war file (obviously)
I would like to create a distribution zip file containing the exploded contents of the war file in a particular location, along with the contents from distribution/src/main/dist.
With this build.gradle for ‘distribution’ I am able to get the war files themselves:
plugins {
id 'distribution'
}
configurations {
warFiles
}
dependencies {
warFiles project(path: ':myWebApp', configuration: 'archives')
}
distributions {
main {
contents {
into('somedirectory/webapps') {
from (project.configurations.warFiles)
}
}
}
}
This puts “myWebApp.war” into ‘someDirectory/webapps’.
Is there a way to unzip myWebApp.war? I tried using zipTree:
distributions {
main {
contents {
into('somedirectory/webapps') {
from (project.zipTree(project.configurations.warFiles))
}
}
}
but that gives an error:
What went wrong:
A problem occurred evaluating project ‘:distribution’.
Cannot convert the provided notation to a File or URI: configuration ‘:distribution:warFiles’.
The following types/formats are supported:
- A String or CharSequence path, for example ‘src/main/java’ or ‘/usr/include’.
- A String or CharSequence URI, for example ‘file:/usr/include’.
- A File instance.
- A Path instance.
- A Directory instance.
- A RegularFile instance.
- A URI or URL instance.
- A TextResource instance.