HHH-12474 - Make sure the JPA version is defined by a single property across build files

This commit is contained in:
Andrea Boriero 2018-04-11 19:18:19 +01:00 committed by Sanne Grinovero
parent 11d28db2f3
commit e2b7317560
8 changed files with 30 additions and 13 deletions

View File

@ -10,7 +10,7 @@ apply plugin: 'base'
ext {
hibernateVersion = '5.3.0-SNAPSHOT'
baselineJavaVersion = '1.8'
jpaVersion = '2.2'
jpaVersion = new JpaVersion('2.2')
final String[] hibernateVersionComponents = project.hibernateVersion.split( '\\.' )
hibernateMajorMinorVersion = hibernateVersionComponents[0] + '.' + hibernateVersionComponents[1]
@ -20,4 +20,21 @@ ext {
}
group = 'org.hibernate'
version = project.hibernateVersion
version = project.hibernateVersion
class JpaVersion {
/** The *normal* name (1.0, 2.0, ..) */
final String name;
final String osgiName
JpaVersion(String version){
this.name = version
this.osgiName = version + ".0"
}
@Override
String toString() {
return name
}
}

View File

@ -60,7 +60,7 @@ ext {
byteBuddy: "net.bytebuddy:byte-buddy:${byteBuddyVersion}",
// javax
jpa: 'javax.persistence:javax.persistence-api:2.2',
jpa: "javax.persistence:javax.persistence-api:${project.jpaVersion}",
jta: 'org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.1.Final',
validation: "javax.validation:validation-api:${validationApiVersion}",
jacc: 'org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.4_spec:1.0.2.Final',

View File

@ -59,7 +59,7 @@ jar {
instruction 'Implementation-Url', 'http://hibernate.org/orm'
instruction 'Hibernate-VersionFamily', project.hibernateMajorMinorVersion
instruction 'Hibernate-JpaVersion', project.jpaVersion
instruction 'Hibernate-JpaVersion', project.jpaVersion.name
}
}

View File

@ -53,7 +53,7 @@ bintray {
sign = true
}
attributes = [
'jpa': '2.2',
'jpa': project.jpaVersion,
'family': project.hibernateMajorMinorVersion
]
mavenCentralSync {

View File

@ -116,7 +116,7 @@ jar {
'javax.validation.metadata;resolution:=optional',
// TODO: Shouldn't have to explicitly list this, but the plugin
// generates it with a [1.0,2) version.
'javax.persistence;version="2.1.0"',
"javax.persistence;version=\"${project.jpaVersion.osgiName}\"",
// Temporarily support JTA 1.1 -- Karaf and other frameworks still
// use it. Without this, the plugin generates [1.2,2).
// build.gradle adds javax.transaction for all modules

View File

@ -43,10 +43,10 @@ jar {
instructionFirst 'Import-Package',
// TODO: Shouldn't have to explicitly list the JPA packages, but
// the plugin generates them with [1.0,2) versions.
'javax.persistence;version="2.1.0"',
'javax.persistence.criteria;version="2.1.0"',
'javax.persistence.metamodel;version="2.1.0"',
'javax.persistence.spi;version="2.1.0"',
"javax.persistence;version=\"${project.jpaVersion.osgiName}\"",
"javax.persistence.criteria;version=\"${project.jpaVersion.osgiName}\"",
"javax.persistence.metamodel;version=\"${project.jpaVersion.osgiName}\"",
"javax.persistence.spi;version=\"${project.jpaVersion.osgiName}\"",
// optionals
'javax.naming;resolution:=optional',
'org.apache.tools.ant;resolution:=optional'

View File

@ -93,7 +93,7 @@ provision {
override( 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api' ) {
groupId = 'javax.persistence'
artifactId = 'javax.persistence-api'
version = '2.2'
version = project.jpaVersion
}
/**TODO: explore overriding any other library we might need?
Example: (not currently necessary)

View File

@ -99,8 +99,8 @@ jar {
instructionFirst 'Import-Package',
// TODO: Shouldn't have to explicitly list this, but the plugin
// generates it with a [1.0,2) version.
'javax.persistence;version="2.1.0"',
'javax.persistence.spi;version="2.1.0"'
"javax.persistence;version=\"${project.jpaVersion.osgiName}\"",
"javax.persistence.spi;version=\"${project.jpaVersion.osgiName}\""
}
}