I am facing the following problem. I have multi module Gradle project. One module is my root project and the second module are integration tests.
In order for my integration tests to run, a copy task needs to run first in order to move some assets to a folder on the root directory of the project.
I already have such a task defined on my root project which when I try to invoke does nothing (I have tried several different way of calling it).
Since this was failing I went ahead and created the following task on the subproject itself:
task prepareTestAssets(type: Copy) {
description = "Copies the needed jars from the root project output build dir"
copy {
from rootProject.configurations.compileClasspath
into ("${rootProject.rootDir}/classes")
rename { fileName -> fileName.replace '-internal', '' }
rename 'ads-(.+).jar', 'ads.jar'
fileMode 0755
}
copy {
from ("${rootProject.buildDir}/libs")
into ("${rootProject.rootDir}/classes")
fileMode 0755
}
}
Which I by having another task depend on it. My goal for this is to have it copy the root project classes as well as the jar generated under build/libs
into a single directory (needed by the integration tests to run).
My problem is that when this runs, it seemingly finds no source and keeps failing.
Can anyone help me troubleshoot why I cannot copy the root project's assets from the context of the subproject
It seems you should leave out the copy{}
closure and specify its contents directly.
The configuration intended for the task is otherwise given to the closure, so the task thinks it has no configuration (it doesn't know to look for a closure called "copy").