All versions of required runtime transitive dependency being excluded

I have a project that uses another project, library-project, that my co-worker wrote. The library-project has dependencies on two other projects that use conflicting versions of commons-lang3. But when I build my project, neither version is in the war file.

The dependency graph looks like:

my.project:library-project:1.0.0-SNAPSHOT
+---my.project:my-dependency-1:1.0.0
|   +---com.opencsv:opencsv:3.3
|       +---org.apache.commons:commons-lang3:3.4
+---my.project:my-dependency-2:1.0.0
    +---org.apache.commons:commons-lang3:3.3.2

And my build.gradle looks like:

apply plugin: 'io.spring.dependency-management'
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'war'

buildscript {
	repositories { 
		jcenter() 
	}
	dependencies { 
		classpath 'io.spring.gradle:dependency-management-plugin:0.3.0.RELEASE' 
	}
}

compileJava {
	sourceCompatibility = 1.7
	targetCompatibility = 1.7
}

configurations.all { 
	exclude group: 'commons-logging' 
}

repositories { 
	jcenter() 
	maven {
		credentials {
			username = "${artifactory_user}"
			password = "${artifactory_password}"
		}
		
		url "myrepo.com"
	}
}

dependencyManagement {
	imports { 
		mavenBom 'io.spring.platform:platform-bom:1.1.2.RELEASE' 
	}
}

dependencies {
	compile "my.project:library-project:1.0.0-SNAPSHOT"
	
	// Spring Framework
	compile 'org.springframework:spring-context'
	compile 'org.springframework:spring-web'
	compile 'org.springframework:spring-webmvc'
	compile 'org.springframework.security:spring-security-config'
	compile 'org.springframework.security:spring-security-web'
	
	// Jackson
	compile "com.fasterxml.jackson.core:jackson-annotations"
	compile "com.fasterxml.jackson.core:jackson-core"
	compile "com.fasterxml.jackson.core:jackson-databind"
	
	// Logging
	compile 'ch.qos.logback:logback-classic'
	compile 'org.slf4j:slf4j-api'
	runtime 'org.slf4j:jcl-over-slf4j'
	runtime 'org.logback-extensions:logback-ext-loggly:0.1.2'

	// Test
	testCompile 'junit:junit'
	testCompile 'org.mockito:mockito-core'
	testCompile 'org.springframework:spring-test'
	
	providedCompile 'javax.servlet:javax.servlet-api'
}

publishing {
	publications {
		mavenJava(MavenPublication) {
			from components.web
		}
	}
	repositories {
		maven {
			credentials {
				username = "${artifactory_user}"
				password = "${artifactory_password}"
			}

			if(project.version.endsWith('-SNAPSHOT')) {
				url "myrepo.com/libs-snapshot-local"
			} else {
				url "myrepo.com/libs-release-local"
			}
		}
	}
}

task wrapper(type: Wrapper) { 
	gradleVersion = '2.4' 
}

And when I look at the debug log when building, it excludes all versions of -org.apache.commons:commons-lang3. Any idea what could lead to my dependency being excluded?

Have you tried without including the io.spring.dependency-management plugin?

Yeah, it’s at the top of my build.gradle

Have you tried WITHOUT including the io.spring.dependency-management plugin?

Just tried it, and it worked, do you know why that would lead to my error?

Most likely one of the poms, of one of your dependencies, is excluding ‘commons-lang3’.

" Based on the configured dependency management metadata, the plugin will control the versions of your project’s direct and transitive dependencies and will honour any exclusions declared in the poms of your project’s dependencies."

I also updated the dependency-management-plugin to 0.5.2.RELEASE and that fixed my problem.