Copy configurations jars task adds a dependency relationship between sub project tasks


(Nikolay Nachev) #1

Hi all, I have a simple goal! I want to copy project configurations jars to a folder without to add dependencies to other sub project tasks (please see the uploaded sample_project.zip (2.0 KB)). I my sample project there are three sub projects api, ear and shared . The ear project has a configuration names projectjars and a task that copies the projectjars configuration dependencies to a folder. This configuration has three dependencies. Both of them are project dependencies to the api and the shared project and the third one is to an external dependency, in my case an ant jar. Furthermore the ear project has a copy tasks. This tasks copies the projectjars entries into a folder:

task copyProjectDependencies(type: Copy) {
from(configurations.projectjars) {
exclude this.project.rootProject.childProjects.collect {it.key + “*”}
}
into (buildDir.path + ‘/jars/’)
}

The tasks defines also excludes over all project artifacts that are included in the configuration. After the task is executed only the ant jar file is copied in the target folder, but during the execution both jar tasks from the api and from the shared project are also executed although the both jars aren’t copied.

Here my question: Is there a possibility to copy ‘all’ the jars from a configuration without the execution of the other project tasks?