Dependencies for multi-project build


(dusiabh) #1

I have working build for a single project

sourceSets {

main {

java {

srcDirs = [ ‘proj1/proj2/proj2/mysrc’ ]

}

} }

dependencies {

compile files(‘dependencies/client1.jar’,

‘dependencies/client2.jar’,

‘lib/task1.jar’) }

//------------------------------------------------------------------------------------------------------------------------------------------------------------ //But when I’m trying implemet same for multi-project build -

//looks like the build ‘doesn’t’ see the dependencies: //------------------------------------------------------------------------------------------------------------------------------------------------------------

allprojects {

group = ‘my.me.em’ }

subprojects {

apply plugin: ‘java’

dependencies {

compile files(‘dependencies/client1.jar’,

‘dependencies/client2.jar’,

‘lib/task1.jar’)

} }

project(’:first’) {

sourceSets {

main {

java {

srcDirs = [ ‘mine/src1’ ]

}

}

}

jar {

archiveName = ‘firstest.jar’

} }

//---------------------------------------------------------------------------------------------------------------------------- //The dependencies section should be used by every project in the multi-project set.

//What is best practice for definition like that? //Thank you very much for your help!


(Luke Daley) #2

You need to change it to:

subprojects {
    apply plugin: 'java'
    dependencies {
        compile rootProject.files('dependencies/client1.jar',
        'dependencies/client2.jar',
        'lib/task1.jar')
    }
}

(dusiabh) #3

Thank you! It’s helping!!!