HHH-12474 - Make sure the JPA version is defined by a single property across build files
This commit is contained in:
parent
11d28db2f3
commit
e2b7317560
|
@ -10,7 +10,7 @@ apply plugin: 'base'
|
||||||
ext {
|
ext {
|
||||||
hibernateVersion = '5.3.0-SNAPSHOT'
|
hibernateVersion = '5.3.0-SNAPSHOT'
|
||||||
baselineJavaVersion = '1.8'
|
baselineJavaVersion = '1.8'
|
||||||
jpaVersion = '2.2'
|
jpaVersion = new JpaVersion('2.2')
|
||||||
|
|
||||||
final String[] hibernateVersionComponents = project.hibernateVersion.split( '\\.' )
|
final String[] hibernateVersionComponents = project.hibernateVersion.split( '\\.' )
|
||||||
hibernateMajorMinorVersion = hibernateVersionComponents[0] + '.' + hibernateVersionComponents[1]
|
hibernateMajorMinorVersion = hibernateVersionComponents[0] + '.' + hibernateVersionComponents[1]
|
||||||
|
@ -20,4 +20,21 @@ ext {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'org.hibernate'
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ ext {
|
||||||
byteBuddy: "net.bytebuddy:byte-buddy:${byteBuddyVersion}",
|
byteBuddy: "net.bytebuddy:byte-buddy:${byteBuddyVersion}",
|
||||||
|
|
||||||
// javax
|
// 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',
|
jta: 'org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:1.0.1.Final',
|
||||||
validation: "javax.validation:validation-api:${validationApiVersion}",
|
validation: "javax.validation:validation-api:${validationApiVersion}",
|
||||||
jacc: 'org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.4_spec:1.0.2.Final',
|
jacc: 'org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.4_spec:1.0.2.Final',
|
||||||
|
|
|
@ -59,7 +59,7 @@ jar {
|
||||||
instruction 'Implementation-Url', 'http://hibernate.org/orm'
|
instruction 'Implementation-Url', 'http://hibernate.org/orm'
|
||||||
|
|
||||||
instruction 'Hibernate-VersionFamily', project.hibernateMajorMinorVersion
|
instruction 'Hibernate-VersionFamily', project.hibernateMajorMinorVersion
|
||||||
instruction 'Hibernate-JpaVersion', project.jpaVersion
|
instruction 'Hibernate-JpaVersion', project.jpaVersion.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ bintray {
|
||||||
sign = true
|
sign = true
|
||||||
}
|
}
|
||||||
attributes = [
|
attributes = [
|
||||||
'jpa': '2.2',
|
'jpa': project.jpaVersion,
|
||||||
'family': project.hibernateMajorMinorVersion
|
'family': project.hibernateMajorMinorVersion
|
||||||
]
|
]
|
||||||
mavenCentralSync {
|
mavenCentralSync {
|
||||||
|
|
|
@ -116,7 +116,7 @@ jar {
|
||||||
'javax.validation.metadata;resolution:=optional',
|
'javax.validation.metadata;resolution:=optional',
|
||||||
// TODO: Shouldn't have to explicitly list this, but the plugin
|
// TODO: Shouldn't have to explicitly list this, but the plugin
|
||||||
// generates it with a [1.0,2) version.
|
// 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
|
// Temporarily support JTA 1.1 -- Karaf and other frameworks still
|
||||||
// use it. Without this, the plugin generates [1.2,2).
|
// use it. Without this, the plugin generates [1.2,2).
|
||||||
// build.gradle adds javax.transaction for all modules
|
// build.gradle adds javax.transaction for all modules
|
||||||
|
|
|
@ -43,10 +43,10 @@ jar {
|
||||||
instructionFirst 'Import-Package',
|
instructionFirst 'Import-Package',
|
||||||
// TODO: Shouldn't have to explicitly list the JPA packages, but
|
// TODO: Shouldn't have to explicitly list the JPA packages, but
|
||||||
// the plugin generates them with [1.0,2) versions.
|
// the plugin generates them with [1.0,2) versions.
|
||||||
'javax.persistence;version="2.1.0"',
|
"javax.persistence;version=\"${project.jpaVersion.osgiName}\"",
|
||||||
'javax.persistence.criteria;version="2.1.0"',
|
"javax.persistence.criteria;version=\"${project.jpaVersion.osgiName}\"",
|
||||||
'javax.persistence.metamodel;version="2.1.0"',
|
"javax.persistence.metamodel;version=\"${project.jpaVersion.osgiName}\"",
|
||||||
'javax.persistence.spi;version="2.1.0"',
|
"javax.persistence.spi;version=\"${project.jpaVersion.osgiName}\"",
|
||||||
// optionals
|
// optionals
|
||||||
'javax.naming;resolution:=optional',
|
'javax.naming;resolution:=optional',
|
||||||
'org.apache.tools.ant;resolution:=optional'
|
'org.apache.tools.ant;resolution:=optional'
|
||||||
|
|
|
@ -93,7 +93,7 @@ provision {
|
||||||
override( 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api' ) {
|
override( 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api' ) {
|
||||||
groupId = 'javax.persistence'
|
groupId = 'javax.persistence'
|
||||||
artifactId = 'javax.persistence-api'
|
artifactId = 'javax.persistence-api'
|
||||||
version = '2.2'
|
version = project.jpaVersion
|
||||||
}
|
}
|
||||||
/**TODO: explore overriding any other library we might need?
|
/**TODO: explore overriding any other library we might need?
|
||||||
Example: (not currently necessary)
|
Example: (not currently necessary)
|
||||||
|
|
|
@ -99,8 +99,8 @@ jar {
|
||||||
instructionFirst 'Import-Package',
|
instructionFirst 'Import-Package',
|
||||||
// TODO: Shouldn't have to explicitly list this, but the plugin
|
// TODO: Shouldn't have to explicitly list this, but the plugin
|
||||||
// generates it with a [1.0,2) version.
|
// generates it with a [1.0,2) version.
|
||||||
'javax.persistence;version="2.1.0"',
|
"javax.persistence;version=\"${project.jpaVersion.osgiName}\"",
|
||||||
'javax.persistence.spi;version="2.1.0"'
|
"javax.persistence.spi;version=\"${project.jpaVersion.osgiName}\""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue