apply plugin: 'java'
apply plugin: 'maven'
group = 'org.test'
repositories {
mavenCentral()
mavenLocal()
}
configurations {
myconf
compile.extendsFrom myconf
}
dependencies {
myconf 'com.google.guava:guava:16.0.1'
}
install.doFirst {
configurations.compile.each { println it }
}
$ gradle install
The compile confiugration contains the dependency but it’s not in the final POM.
If this a feature, how can I make this work (without manual POM modification)
Currently only dependencies added directly to the default configurations added by the ‘java’ (or ‘war’) plugins are added to the POM when using the ‘maven’ plugin. You will either have to manually modify the POM XML to add these dependency declarations or use the new ‘maven-publish’ plugin which will include dependencies from superconfigurations but they will all be added to the ‘runtime’ scope.
I think I found solution:
configurations.compile.extendsFrom.each {
install.repositories.mavenInstaller.pom.scopeMappings.addMapping(100, it, 'compile')
}