You can define a "super-project" with some name, e.g. 'myProject' and put all your current projects into this one as subprojects.
project(':myProject') {
subprojects {
dependencies {
// your global dependencies
}
}
project('myWarProject') {
}
project('myJarProject1') {
}
project('myJarProject2') {
}
}
But I think, it's not a good idea to organize projects like this. I don't really understand why do you have so many projects with the same dependencies. Normally you should have one war-project with all war-specific dependencies and some other non-war relevant projects with APIs and implementations of defined interfaces. In this case all dependencies of the API project will be automatically added as transitive to all other projects, you just have to define the API project as a compile dependency.
def jar1 = project('myJarProject1') {
dependencies {
// dependencies of project-1
}
}
def jar2 = project('myJarProject2') {
dependencies {
// dependencies of project-2
}
}
project('myWarProject') {
dependencies {
compile jar1 // includes all project-1 dependencies as transitive
compile jar2 // includes all project-2 dependencies as transitive
// add war-specific dependencies here
}
}