I am wondering how to get the war archive output. I have a project that one subproject builds a war file, and another subproject builds a distribution. The following code works (in a copy task):
into('folder') {
from project(':myproject-jar').jar
}
But, when I am referencing a war project, the follwing does not work:
into('folder') {
from project(':myproject-war').war
}
Problem solved. I figured out that I need to depend on the ‘myproject-war’ before. But it’s something weird here since I do not need to depend on ‘myproject-jar’ when I am doing the first approach.
Anyway, I am happy Added the following code ontop of my distribution build:
Sounds like an evaluation order problem where the ‘war’ task hasn’t been defined yet when the ‘copy’ task gets evaluated.
‘Project.dependsOn’ may be a bit of overkill here. One alternative is ‘Project.evaluationDependsOn’. Another alternative is to defer the evaluation of ‘from’ with a closure: