I am using gradle 2.1 and trying to use the maven plugin to write a pom file.
However, whenever I have the repository closure inside the distributionManagement, it will throw the following exception:
Execution failed for task ‘:core:writeNewPom’. > Cannot cast object ‘org.apache.maven.model.Repository@47a5ea25’ with class ‘org.apache.maven.model.Repository’ to class ‘org.apache.maven.model.DeploymentRepository’
apply plugin: 'maven'
task writeNewPom << {
pom {
project {
inceptionYear '2014'
distributionManagement {
repository {
id 'maven'
name 'Maven'
url 'xxxxxxxx'
}
snapshotRepository {
id 'snapshots-maven'
name 'Snapshots Maven'
url 'xxxxxxxx'
}
}
}
}.writeTo("$buildDir/newpom.xml")
}
It is working fine if I remove the repository closure.
Thanks.