I have multi module project. The parent project has defined list of configuration library. Each child module will be extending specific configuration instead of defining the dependencies again. When we execute the gradle task, install or uploadArchives, the generated pom does not have dependencies from configuration extension but it has dependencies from compile section. Example is given below.
repositories {
mavenCentral()
mavenLocal()
}
group = 'com.test'
version = '0.0.3'
apply plugin: 'java'
apply plugin: 'maven'
configurations {
springLib
compile.extendsFrom springLib
}
dependencies {
springLib "org.springframework:spring-core:3.2.2.RELEASE"
compile "org.slf4j:slf4j-api:1.6.6"
}
The generate pom is
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<version>0.0.3</version>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.6</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
The generated pom has “slf4j” library in the dependency list but not the “spring-core”.
Is there any mistake in my gradle script? Is a known problem? If this is working as expected then why does gradle doing like this and how do I solve it.
Thanks, -Sridharan