HHH-12674 Use new approach to define pom.xml metadata

This commit is contained in:
Sanne Grinovero 2018-06-13 10:46:15 +01:00
parent 2dbfcc7135
commit cb9baa1728
1 changed files with 39 additions and 49 deletions

View File

@ -7,63 +7,53 @@
apply plugin: 'maven-publish'
afterEvaluate {
// delay pom customization until project evaluation is complete
publishing {
PublishingExtension gradlePublishingExtension = project.extensions.getByType( PublishingExtension )
publications {
publishedArtifacts {
pom {
name = 'Hibernate ORM - ' + project.name
description = project.description
url = 'http://hibernate.org/orm'
Set<MavenPublication> mavenPublications = gradlePublishingExtension.publications.withType( MavenPublication )
if ( mavenPublications.size() <= 0 || mavenPublications.size() > 1 ) {
throw new GradleException( "Expecting just a single MavenPublication [$project.path], but found " + mavenPublications.size() + " : " + mavenPublications*.name )
}
project.configure( mavenPublications.first() ) {
pom.withXml {
asNode().appendNode( 'name', "Hibernate ORM - $project.name" )
asNode().appendNode( 'description', project.description )
Node lgplLicenseNode = asNode().appendNode( "licenses" ).appendNode( "license" )
lgplLicenseNode.appendNode( 'name', 'GNU Library General Public License v2.1 or later' )
lgplLicenseNode.appendNode( 'url', 'http://www.opensource.org/licenses/LGPL-2.1' )
lgplLicenseNode.appendNode(
'comments',
'See discussion at http://hibernate.org/community/license/ for more details.'
)
lgplLicenseNode.appendNode( 'distribution', 'repo' )
asNode().children().last() + {
url 'http://hibernate.org'
organization {
name 'Hibernate.org'
url 'http://hibernate.org'
name = 'Hibernate.org'
url = 'http://hibernate.org'
}
issueManagement {
system 'jira'
url 'https://hibernate.atlassian.net/browse/HHH'
}
scm {
url 'http://github.com/hibernate/hibernate-orm'
connection 'scm:git:http://github.com/hibernate/hibernate-orm.git'
developerConnection 'scm:git:git@github.com:hibernate/hibernate-orm.git'
}
developers {
developer {
id 'hibernate-team'
name 'The Hibernate Development Team'
organization 'Hibernate.org'
organizationUrl 'http://hibernate.org'
licenses {
license {
name = 'GNU Library General Public License v2.1 or later'
url = 'http://www.opensource.org/licenses/LGPL-2.1'
comments = 'See discussion at http://hibernate.org/community/license/ for more details.'
distribution = 'repo'
}
}
scm {
url = 'http://github.com/hibernate/hibernate-orm'
connection = 'scm:git:http://github.com/hibernate/hibernate-orm.git'
developerConnection = 'scm:git:git@github.com:hibernate/hibernate-orm.git'
}
issueManagement {
system = 'jira'
url = 'https://hibernate.atlassian.net/browse/HHH'
}
developers {
developer {
id = 'hibernate-team'
name = 'The Hibernate Development Team'
organization = 'Hibernate.org'
organizationUrl = 'http://hibernate.org'
}
}
}
// TEMPORARY : currently Gradle Publishing feature is exporting dependencies as 'runtime' scope,
// rather than 'compile'; fix that.
if ( asNode().dependencies != null && asNode().dependencies.size() > 0 ) {
asNode().dependencies[0].dependency.each {
it.scope[0].value = 'compile'
}
}
}
}
}
}