HHH-13689 Replace uses of the deprecated osgi plugin with the biz.aQute.bnd plugin
https://docs.gradle.org/5.0-milestone-1/release-notes.html#deprecated-osgi-plugin
This commit is contained in:
parent
b301162660
commit
f795213e5a
|
@ -17,6 +17,7 @@ buildscript {
|
||||||
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.7'
|
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.7'
|
||||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
|
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
|
||||||
classpath 'de.thetaphi:forbiddenapis:2.5'
|
classpath 'de.thetaphi:forbiddenapis:2.5'
|
||||||
|
classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:4.2.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ apply from: rootProject.file( 'gradle/libraries.gradle' )
|
||||||
apply from: rootProject.file( 'gradle/databases.gradle' )
|
apply from: rootProject.file( 'gradle/databases.gradle' )
|
||||||
|
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'osgi'
|
apply plugin: 'biz.aQute.bnd.builder'
|
||||||
|
|
||||||
apply plugin: 'checkstyle'
|
apply plugin: 'checkstyle'
|
||||||
apply plugin: 'build-dashboard'
|
apply plugin: 'build-dashboard'
|
||||||
|
|
|
@ -10,69 +10,90 @@ apply from: rootProject.file( 'gradle/java-module.gradle' )
|
||||||
apply from: rootProject.file( 'gradle/publishing-repos.gradle' )
|
apply from: rootProject.file( 'gradle/publishing-repos.gradle' )
|
||||||
apply from: rootProject.file( 'gradle/publishing-pom.gradle' )
|
apply from: rootProject.file( 'gradle/publishing-pom.gradle' )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// Jar
|
// Jar
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest = osgiManifest {
|
manifest {
|
||||||
// GRADLE-1411: Even if we override Imports and Exports
|
attributes(
|
||||||
// auto-generation with instructions, classesDir and classpath
|
// Basic JAR manifest attributes
|
||||||
// need to be here (temporarily).
|
'Specification-Title': project.name,
|
||||||
|
'Specification-Version': project.version,
|
||||||
|
'Specification-Vendor': 'Hibernate.org',
|
||||||
|
'Implementation-Title': project.name,
|
||||||
|
'Implementation-Version': project.version,
|
||||||
|
'Implementation-Vendor': 'Hibernate.org',
|
||||||
|
'Implementation-Vendor-Id': 'org.hibernate',
|
||||||
|
'Implementation-Url': 'http://hibernate.org/orm',
|
||||||
|
|
||||||
if ( project.pluginManager.hasPlugin( 'groovy' ) ) {
|
// Java 9 module name
|
||||||
classesDir = sourceSets.main.groovy.outputDir
|
'Automatic-Module-Name': project.java9ModuleName,
|
||||||
}
|
|
||||||
else {
|
|
||||||
classesDir = sourceSets.main.java.outputDir
|
|
||||||
}
|
|
||||||
classpath = configurations.runtime
|
|
||||||
|
|
||||||
|
// Hibernate-specific JAR manifest attributes
|
||||||
|
'Hibernate-VersionFamily': project.ormVersion.family,
|
||||||
|
'Hibernate-JpaVersion': project.jpaVersion.name,
|
||||||
|
|
||||||
// Java 9 module name
|
// BND Plugin instructions (for OSGi):
|
||||||
instruction 'Automatic-Module-Name', project.java9ModuleName
|
'Bundle-Name': project.name,
|
||||||
|
'Bundle-SymbolicName': project.java9ModuleName,
|
||||||
// the OSGi metadata
|
'Bundle-Vendor': 'Hibernate.org',
|
||||||
symbolicName project.java9ModuleName
|
'Bundle-DocURL': "http://www.hibernate.org/orm/${project.ormVersion.family}",
|
||||||
vendor 'Hibernate.org'
|
// This is overridden in some sub-projects
|
||||||
description project.description
|
'Import-Package': [
|
||||||
docURL "http://www.hibernate.org/orm/${project.ormVersion.family}"
|
// Temporarily support JTA 1.1 -- Karaf and other frameworks still
|
||||||
|
// use it. Without this, the plugin generates [1.2,2).
|
||||||
instruction 'Import-Package',
|
'javax.transaction;version="[1.1,2)"',
|
||||||
// Temporarily support JTA 1.1 -- Karaf and other frameworks still
|
// Also import every package referenced in the code
|
||||||
// use it. Without this, the plugin generates [1.2,2).
|
// (note that '*' is resolved at build time to a list of packages)
|
||||||
'javax.transaction;version="[1.1,2)"',
|
'*'
|
||||||
// Tell Gradle OSGi to still dynamically import the other packages.
|
].join( ',' ),
|
||||||
// IMPORTANT: Do not include the * in the modules' .gradle files.
|
'-exportcontents': "*;version=${project.version}"
|
||||||
// If it exists more than once, the manifest will physically contain a *.
|
)
|
||||||
'*'
|
|
||||||
|
|
||||||
// Basic JAR manifest metadata
|
|
||||||
instruction 'Specification-Title', project.name
|
|
||||||
instruction 'Specification-Version', project.version
|
|
||||||
instruction 'Specification-Vendor', 'Hibernate.org'
|
|
||||||
instruction 'Implementation-Title', project.name
|
|
||||||
instruction 'Implementation-Version', project.version
|
|
||||||
instruction 'Implementation-Vendor', 'Hibernate.org'
|
|
||||||
instruction 'Implementation-Vendor-Id', 'org.hibernate'
|
|
||||||
instruction 'Implementation-Url', 'http://hibernate.org/orm'
|
|
||||||
|
|
||||||
instruction 'Hibernate-VersionFamily', project.ormVersion.family
|
|
||||||
instruction 'Hibernate-JpaVersion', project.jpaVersion.name
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
task sourcesJar(type: Jar) {
|
||||||
from project.sourceSets.main.allSource
|
from project.sourceSets.main.allSource
|
||||||
manifest = project.tasks.jar.manifest
|
manifest {
|
||||||
|
attributes(
|
||||||
|
// Basic JAR manifest attributes
|
||||||
|
'Specification-Title': project.name,
|
||||||
|
'Specification-Version': project.version,
|
||||||
|
'Specification-Vendor': 'Hibernate.org',
|
||||||
|
'Implementation-Title': project.name,
|
||||||
|
'Implementation-Version': project.version,
|
||||||
|
'Implementation-Vendor': 'Hibernate.org',
|
||||||
|
'Implementation-Vendor-Id': 'org.hibernate',
|
||||||
|
'Implementation-Url': 'http://hibernate.org/orm',
|
||||||
|
|
||||||
|
// Hibernate-specific JAR manifest attributes
|
||||||
|
'Hibernate-VersionFamily': project.ormVersion.family,
|
||||||
|
'Hibernate-JpaVersion': project.jpaVersion.name
|
||||||
|
)
|
||||||
|
}
|
||||||
archiveClassifier.set( 'sources' )
|
archiveClassifier.set( 'sources' )
|
||||||
}
|
}
|
||||||
|
|
||||||
task javadocJar(type: Jar) {
|
task javadocJar(type: Jar) {
|
||||||
from project.tasks.javadoc.outputs
|
from project.tasks.javadoc.outputs
|
||||||
manifest = project.tasks.jar.manifest
|
manifest {
|
||||||
|
attributes(
|
||||||
|
// Basic JAR manifest attributes
|
||||||
|
'Specification-Title': project.name,
|
||||||
|
'Specification-Version': project.version,
|
||||||
|
'Specification-Vendor': 'Hibernate.org',
|
||||||
|
'Implementation-Title': project.name,
|
||||||
|
'Implementation-Version': project.version,
|
||||||
|
'Implementation-Vendor': 'Hibernate.org',
|
||||||
|
'Implementation-Vendor-Id': 'org.hibernate',
|
||||||
|
'Implementation-Url': 'http://hibernate.org/orm',
|
||||||
|
|
||||||
|
// Hibernate-specific JAR manifest attributes
|
||||||
|
'Hibernate-VersionFamily': project.ormVersion.family,
|
||||||
|
'Hibernate-JpaVersion': project.jpaVersion.name
|
||||||
|
)
|
||||||
|
}
|
||||||
archiveClassifier.set( 'javadoc' )
|
archiveClassifier.set( 'javadoc' )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,39 +103,54 @@ dependencies {
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
mainAttributes( 'Main-Class': 'org.hibernate.Version' )
|
attributes(
|
||||||
|
'Main-Class': 'org.hibernate.Version',
|
||||||
|
|
||||||
instructionFirst 'Import-Package',
|
// BND Plugin instructions (for OSGi):
|
||||||
'javax.security.auth;resolution:=optional',
|
'Import-Package': [
|
||||||
'javax.security.jacc;resolution:=optional',
|
'javax.security.auth;resolution:=optional',
|
||||||
'javax.validation;resolution:=optional',
|
// Make javax.security.jacc optional and do not reference a version range (because that's what we used to do)
|
||||||
'javax.validation.constraints;resolution:=optional',
|
'javax.security.jacc;resolution:=optional;version=!',
|
||||||
'javax.validation.groups;resolution:=optional',
|
// Make javax.validation optional and do not reference a version range (because that's what we used to do)
|
||||||
'javax.validation.metadata;resolution:=optional',
|
'javax.validation;resolution:=optional;version=!',
|
||||||
// TODO: Shouldn't have to explicitly list this, but the plugin
|
'javax.validation.constraints;resolution:=optional;version=!',
|
||||||
// generates it with a [1.0,2) version.
|
'javax.validation.groups;resolution:=optional;version=!',
|
||||||
"javax.persistence;version=\"${project.jpaVersion.osgiName}\"",
|
'javax.validation.metadata;resolution:=optional;version=!',
|
||||||
// optionals
|
// Make javax.enterprise optional and do not reference a version range (because that's what we used to do)
|
||||||
'javax.management;resolution:=optional',
|
'!javax.enterprise*',
|
||||||
'javax.naming.event;resolution:=optional',
|
'javax.enterprise.context.spi;resolution:=optional;version=!',
|
||||||
'javax.naming.spi;resolution:=optional',
|
'javax.enterprise.inject.spi;resolution:=optional;version=!',
|
||||||
'org.apache.tools.ant;resolution:=optional',
|
// For JPA, we don't want to target the automatically generated range, but a specific version
|
||||||
'org.apache.tools.ant.taskdefs;resolution:=optional',
|
"javax.persistence;version=\"${project.jpaVersion.osgiName}\"",
|
||||||
'org.apache.tools.ant.types;resolution:=optional',
|
// optionals
|
||||||
'!javax.enterprise*',
|
'javax.management;resolution:=optional',
|
||||||
'javax.enterprise.context.spi;resolution:=optional',
|
'javax.naming.event;resolution:=optional',
|
||||||
'javax.enterprise.inject.spi;resolution:=optional',
|
'javax.naming.spi;resolution:=optional',
|
||||||
'javax.inject;resolution:=optional',
|
'org.apache.tools.ant;resolution:=optional',
|
||||||
'net.bytebuddy.*;resolution:=optional',
|
'org.apache.tools.ant.taskdefs;resolution:=optional',
|
||||||
// We must specify the version explicitly to allow Karaf
|
'org.apache.tools.ant.types;resolution:=optional',
|
||||||
// to use an older version of JAXB (the only one we can use in Karaf)
|
'javax.inject;resolution:=optional',
|
||||||
"javax.xml.bind.*;version=\"${project.jaxbApiVersionOsgiRange}\""
|
'net.bytebuddy.*;resolution:=optional',
|
||||||
|
'org.objectweb.jonas_tm;resolution:=optional',
|
||||||
// // TODO: Uncomment once EntityManagerFactoryBuilderImpl no longer
|
'com.ibm.websphere.jtaextensions;resolution:=optional',
|
||||||
// // uses ClassLoaderServiceImpl.
|
// We must specify the version explicitly to allow Karaf
|
||||||
// instruction 'Export-Package',
|
// to use an older version of JAXB (the only one we can use in Karaf)
|
||||||
// 'org.hibernate.boot.registry.classloading.internal',
|
"javax.xml.bind.*;version=\"${project.jaxbApiVersionOsgiRange}\"",
|
||||||
// '*'
|
// Temporarily support JTA 1.1 -- Karaf and other frameworks still
|
||||||
|
// use it. Without this, the plugin generates [1.2,2).
|
||||||
|
'javax.transaction;version="[1.1,2)"',
|
||||||
|
// Also import every package referenced in the code
|
||||||
|
'*'
|
||||||
|
].join( ',' ),
|
||||||
|
'-exportcontents': [
|
||||||
|
// Legacy resource packages containing XSDs that were traditionally not exported
|
||||||
|
"!org.hibernate.xsd.cfg",
|
||||||
|
"!org.hibernate.xsd.mapping",
|
||||||
|
// TODO: Uncomment once EntityManagerFactoryBuilderImpl no longer uses ClassLoaderServiceImpl.
|
||||||
|
//'org.hibernate.boot.registry.classloading.internal',
|
||||||
|
"*;version=${project.version}"
|
||||||
|
].join( ',' ),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,19 +12,21 @@ dependencies {
|
||||||
compile( libraries.jta )
|
compile( libraries.jta )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// The OSGi JAR manifest support does not like a non-existent classes dir,
|
// Traditionally we used to not include any manifest attributes in this JAR
|
||||||
// so make sure we dont use the OSGi one :)
|
// except "Manifest-Version"
|
||||||
|
// Since it's a legacy JAR, let's continue that way until it's retired.
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest = null
|
manifest.attributes.removeAll { key, value -> key != "Manifest-Version" }
|
||||||
|
// Prevent BND from adding manifest attributes automatically
|
||||||
|
bnd( '-nobundles': 'true' )
|
||||||
}
|
}
|
||||||
|
|
||||||
sourcesJar {
|
sourcesJar {
|
||||||
manifest = null
|
manifest.attributes.removeAll { key, value -> key != "Manifest-Version" }
|
||||||
}
|
}
|
||||||
|
|
||||||
javadocJar {
|
javadocJar {
|
||||||
manifest = null
|
manifest.attributes.removeAll { key, value -> key != "Manifest-Version" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,16 +40,25 @@ sourceSets {
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
instructionFirst 'Import-Package',
|
attributes(
|
||||||
// TODO: Shouldn't have to explicitly list the JPA packages, but
|
// BND Plugin instructions (for OSGi):
|
||||||
// the plugin generates them with [1.0,2) versions.
|
'Import-Package': [
|
||||||
"javax.persistence;version=\"${project.jpaVersion.osgiName}\"",
|
// TODO: Shouldn't have to explicitly list the JPA packages, but
|
||||||
"javax.persistence.criteria;version=\"${project.jpaVersion.osgiName}\"",
|
// the plugin generates them with [1.0,2) versions.
|
||||||
"javax.persistence.metamodel;version=\"${project.jpaVersion.osgiName}\"",
|
"javax.persistence;version=\"${project.jpaVersion.osgiName}\"",
|
||||||
"javax.persistence.spi;version=\"${project.jpaVersion.osgiName}\"",
|
"javax.persistence.criteria;version=\"${project.jpaVersion.osgiName}\"",
|
||||||
// optionals
|
"javax.persistence.metamodel;version=\"${project.jpaVersion.osgiName}\"",
|
||||||
'javax.naming;resolution:=optional',
|
"javax.persistence.spi;version=\"${project.jpaVersion.osgiName}\"",
|
||||||
'org.apache.tools.ant;resolution:=optional'
|
// optionals
|
||||||
|
'javax.naming;resolution:=optional',
|
||||||
|
'org.apache.tools.ant;resolution:=optional',
|
||||||
|
// Temporarily support JTA 1.1 -- Karaf and other frameworks still
|
||||||
|
// use it. Without this, the plugin generates [1.2,2).
|
||||||
|
'javax.transaction;version="[1.1,2)"',
|
||||||
|
// Also import every package referenced in the code
|
||||||
|
'*'
|
||||||
|
].join( ',' )
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,18 +6,22 @@ description = '(deprecated - use hibernate-core instead) Support for Java8-speci
|
||||||
dependencies {
|
dependencies {
|
||||||
compile( project( ':hibernate-core' ) )
|
compile( project( ':hibernate-core' ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// The OSGi JAR manifest support does not like a non-existent classes dir,
|
// Traditionally we used to not include any manifest attributes in this JAR
|
||||||
// so make sure we dont use the OSGi one :)
|
// except "Manifest-Version"
|
||||||
|
// Since it's a legacy JAR, let's continue that way until it's retired.
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest = null
|
manifest.attributes.removeAll { key, value -> key != "Manifest-Version" }
|
||||||
|
// Prevent BND from adding manifest attributes automatically
|
||||||
|
bnd( '-nobundles': 'true' )
|
||||||
}
|
}
|
||||||
|
|
||||||
sourcesJar {
|
sourcesJar {
|
||||||
manifest = null
|
manifest.attributes.removeAll { key, value -> key != "Manifest-Version" }
|
||||||
}
|
}
|
||||||
|
|
||||||
javadocJar {
|
javadocJar {
|
||||||
manifest = null
|
manifest.attributes.removeAll { key, value -> key != "Manifest-Version" }
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,13 +102,22 @@ dependencies {
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
manifest {
|
manifest {
|
||||||
instruction 'Bundle-Activator', 'org.hibernate.osgi.HibernateBundleActivator'
|
attributes(
|
||||||
instruction 'Provide-Capability', 'osgi.service;effective:=active;objectClass=javax.persistence.spi.PersistenceProvider'
|
// BND Plugin instructions (for OSGi):
|
||||||
instructionFirst 'Import-Package',
|
'Bundle-Activator': 'org.hibernate.osgi.HibernateBundleActivator',
|
||||||
// TODO: Shouldn't have to explicitly list this, but the plugin
|
'Provide-Capability': 'osgi.service;effective:=active;objectClass=javax.persistence.spi.PersistenceProvider',
|
||||||
// generates it with a [1.0,2) version.
|
'Import-Package': [
|
||||||
"javax.persistence;version=\"${project.jpaVersion.osgiName}\"",
|
// TODO: Shouldn't have to explicitly list this, but the plugin
|
||||||
"javax.persistence.spi;version=\"${project.jpaVersion.osgiName}\""
|
// generates it with a [1.0,2) version.
|
||||||
|
"javax.persistence;version=\"${project.jpaVersion.osgiName}\"",
|
||||||
|
"javax.persistence.spi;version=\"${project.jpaVersion.osgiName}\"",
|
||||||
|
// Temporarily support JTA 1.1 -- Karaf and other frameworks still
|
||||||
|
// use it. Without this, the plugin generates [1.2,2).
|
||||||
|
'javax.transaction;version="[1.1,2)"',
|
||||||
|
// Also import every package referenced in the code
|
||||||
|
'*'
|
||||||
|
].join( ',' )
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue