How can I add multiple project dependencies to a configuration in one instruction in gradle

StackOverflow https://stackoverflow.com/questions/22659283

سؤال

I am trying to add multiple project in one instruction dependencies (to use only one configuration closure) with gradle but I don't know how to do it.

If try to do

configurationName (
    project('subProject1') ,
    project('subProject2'),
) {
    transitive = false
}

I got an error at the configuration step, but

configurationName (
    project('subProject1') ,
) {
    transitive = false
}

configurationName (
    project('subProject2') ,
) {
    transitive = false
}

I don't know why, when

configurationName(
    [group: 'commons-dbutils', name: 'commons-dbutils', version: '1.5'],
    [group: 'org.springframework', name: 'spring-tx', version: springVersion],
    'org.apache.commons:commons-collections4:4.0'
)

works perfectly.

هل كانت مفيدة؟

المحلول

You'll have to repeat { transitive = false } for each project dependency. Alternatively, you can make the whole configuration non-transitive (configurations.configurationName { transitive = false }).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top