HHH-14513 : Move publishing release and snapshot artifacts to Sonatype OSSRH

This commit is contained in:
Steve Ebersole 2021-05-14 14:59:59 -05:00
parent d53216306f
commit c7e37dc1d7
25 changed files with 489 additions and 562 deletions

144
README.adoc Normal file
View File

@ -0,0 +1,144 @@
Hibernate ORM is a library providing Object/Relational Mapping (ORM) support
to applications, libraries, and frameworks.
It also provides an implementation of the JPA specification, which is the standard Java specification for ORM.
This is the repository of its source code; see http://hibernate.org/orm/[Hibernate.org] for additional information.
image:http://ci.hibernate.org/job/hibernate-orm-main-h2-main/badge/icon[Build Status,link=http://ci.hibernate.org/job/hibernate-orm-main-h2-main/]
image:https://img.shields.io/lgtm/grade/java/g/hibernate/hibernate-orm.svg?logo=lgtm&logoWidth=18[Language grade: Java,link=https://lgtm.com/projects/g/hibernate/hibernate-orm/context:java]
== Continuous Integration
Hibernate uses both http://jenkins-ci.org[Jenkins] and https://github.com/features/actions[GitHub Actions]
for its CI needs. See
* http://ci.hibernate.org/view/ORM/[Jenkins Jobs]
* https://github.com/hibernate/hibernate-orm/actions[GitHub Actions Jobs]
== Building from sources
The build requires at least Java 8 JDK.
Hibernate uses https://gradle.org[Gradle] as its build tool. See the _Gradle Primer_ section below if you are new to
Gradle.
Contributors should read the link:CONTRIBUTING.md[Contributing Guide].
See the guides for setting up http://hibernate.org/community/contribute/intellij-idea/[IntelliJ] or
https://hibernate.org/community/contribute/eclipse-ide/[Eclipse] as your development environment.
== Gradle Primer
The Gradle build tool has amazing documentation. 2 in particular that are indispensable:
* https://docs.gradle.org/current/userguide/userguide_single.html[Gradle User Guide] is a typical user guide in that
it follows a topical approach to describing all of the capabilities of Gradle.
* https://docs.gradle.org/current/dsl/index.html[Gradle DSL Guide] is unique and excellent in quickly
getting up to speed on certain aspects of Gradle.
We will cover the basics developers and contributors new to Gradle need to know to get productive quickly.
NOTE: The project defines a https://docs.gradle.org/current/userguide/gradle_wrapper.html[Gradle Wrapper].
The rest of the section will assume execution through the wrapper.
=== Executing Tasks
Gradle uses the concept of build tasks (equivalent to Ant targets or Maven phases/goals). You can get a list of
available tasks via
----
gradle tasks
----
To execute a task across all modules, simply perform that task from the root directory. Gradle will visit each
sub-project and execute that task if the sub-project defines it. To execute a task in a specific module you can
either:
. `cd` into that module directory and execute the task
. name the "task path". For example, to run the tests for the _hibernate-core_ module from the root directory
you could say `gradle hibernate-core:test`
=== Common tasks
The common tasks you might use in building Hibernate include:
* _build_ - Assembles (jars) and tests this project
* _compile_ - Performs all compilation tasks including staging resources from both main and test
* _jar_ - Generates a jar archive with all the compiled classes
* _test_ - Runs the tests
* _publishToMavenLocal_ - Installs the project jar to your local maven cache (aka ~/.m2/repository). Note that Gradle
never uses this, but it can be useful for testing your build with other local Maven-based builds.
* _clean_ - Cleans the build directory
== Testing and databases
Testing against a specific database can be achieved in 2 different ways:
=== Using the "Matrix Testing Plugin" for Gradle.
Coming later…
=== Using "profiles"
The Hibernate build defines several database testing "profiles" in `databases.gradle`. These
profiles can be activated by name using the `db` build property which can be passed either as
a JVM system prop (`-D`) or as a Gradle project property (`-P`). Examples below use the Gradle
project property approach.
----
gradle clean build -Pdb=pgsql
----
To run a test from your IDE, you need to ensure the property expansions happen.
Use the following command:
----
gradle clean compile -Pdb=pgsql
----
__NOTE: If you are running tests against a JDBC driver that is not available via Maven central be sure to
add these drivers to your local Maven repo cache (~/.m2/repository) or (better) add it to a personal Maven repo server__
=== Running database-specific tests from the IDE using "profiles"
You can run any test on any particular database that is configured in a `databases.gradle` profile.
All you have to do is run the following command:
----
gradlew setDataBase -Pdb=pgsql
----
or you can use the shortcut version:
----
gradlew sDB -Pdb=pgsql
----
You can do this from the module which you are interested in testing or from the `hibernate-orm` root folder.
Afterward, just pick any test from the IDE and run it as usual. Hibernate will pick the database configuration from the `hibernate.properties`
file that was set up by the `setDataBase` Gradle task.
=== Starting test databases locally as docker containers
You don't have to install all databases locally to be able to test against them in case you have docker available.
The script `docker_db.sh` allows you to start a pre-configured database which can be used for testing.
All you have to do is run the following command:
----
./docker_db.sh postgresql_9_5
----
omitting the argument will print a list of possible options.
When the database is properly started, you can run tests with special profiles that are suffixed with `_ci`
e.g. `pgsql_ci` for PostgreSQL. By using the system property `dbHost` you can configure the IP address of your docker host.
The command for running tests could look like the following:
----
gradlew test -Pdb=pgsql_ci "-DdbHost=192.168.99.100"
----

169
README.md
View File

@ -1,169 +0,0 @@
<img src="http://static.jboss.org/hibernate/images/hibernate_logo_whitebkg_200px.png" />
Hibernate ORM is a library providing Object/Relational Mapping (ORM) support
to applications, libraries, and frameworks.
It also provides an implementation of the JPA specification, which is the standard Java specification for ORM.
This is the repository of its source code: see [Hibernate.org](http://hibernate.org/orm/) for additional information.
[![Build Status](http://ci.hibernate.org/job/hibernate-orm-main-h2-main/badge/icon)](http://ci.hibernate.org/job/hibernate-orm-main-h2-main/)
[![Language grade: Java](https://img.shields.io/lgtm/grade/java/g/hibernate/hibernate-orm.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/hibernate/hibernate-orm/context:java)
Continuous Integration
======================
Hibernate uses both [Jenkins](http://jenkins-ci.org) and [TravisCI](https://travis-ci.org/) for its CI needs. See
* [Jenkins Jobs](http://ci.hibernate.org/view/ORM/)
* [TravisCI Jobs](https://travis-ci.org/hibernate/hibernate-orm)
Building from sources
=====================
The build requires a Java 8 JDK as JAVA_HOME.
You will need [Git](https://git-scm.com/) to obtain the [source](https://github.com/hibernate/hibernate-orm/).
Hibernate uses [Gradle](https://gradle.org) as its build tool. See the _Gradle Primer_ section below if you are new to
Gradle.
Contributors should read the [Contributing Guide](CONTRIBUTING.md).
See the guides for setting up [IntelliJ](http://hibernate.org/community/contribute/intellij-idea/) or
[Eclipse](https://hibernate.org/community/contribute/eclipse-ide/) as your development environment.
Check out the _Getting Started_ section in CONTRIBUTING.md for getting started working on Hibernate source.
Gradle Primer
============
This section describes some of the basics developers and contributors new to Gradle might
need to know to get productive quickly. The Gradle documentation is very well done; 2 in
particular that are indispensable:
* [Gradle User Guide](https://docs.gradle.org/current/userguide/userguide_single.html) is a typical user guide in that
it follows a topical approach to describing all of the capabilities of Gradle.
* [Gradle DSL Guide](https://docs.gradle.org/current/dsl/index.html) is unique and excellent in quickly
getting up to speed on certain aspects of Gradle.
Using the Gradle Wrapper
------------------------
For contributors who do not otherwise use Gradle and do not want to install it, Gradle offers a very cool
feature called the wrapper. It lets you run Gradle builds without a previously installed Gradle distro in
a zero-conf manner. Hibernate configures the Gradle wrapper for you. If you would rather use the wrapper and
not install Gradle (or to make sure you use the version of Gradle intended for older builds) you would just use
the command `gradlew` (or `gradlew.bat`) rather than `gradle` (or `gradle.bat`) in the following discussions.
Note that `gradlew` is only available in the project's root dir, so depending on your working directory you may
need to adjust the path to `gradlew` as well.
Examples use the `gradle` syntax, but just swap `gradlew` (properly relative) for `gradle` if you wish to use
the wrapper.
Another reason to use `gradlew` is that it uses the exact version of Gradle that the build is defined to work with.
Executing Tasks
------------------------
Gradle uses the concept of build tasks (equivalent to Ant targets or Maven phases/goals). You can get a list of
available tasks via
gradle tasks
To execute a task across all modules, simply perform that task from the root directory. Gradle will visit each
sub-project and execute that task if the sub-project defines it. To execute a task in a specific module you can
either:
1. `cd` into that module directory and execute the task
2. name the "task path". For example, to run the tests for the _hibernate-core_ module from the root directory you could say `gradle hibernate-core:test`
Common Java related tasks
------------------------
* _build_ - Assembles (jars) and tests this project
* _buildDependents_ - Assembles and tests this project and all projects that depend on it. So think of running this in hibernate-core, Gradle would assemble and test hibernate-core as well as hibernate-envers (because envers depends on core)
* _classes_ - Compiles the main classes
* _testClasses_ - Compiles the test classes
* _compile_ (Hibernate addition) - Performs all compilation tasks including staging resources from both main and test
* _jar_ - Generates a jar archive with all the compiled classes
* _test_ - Runs the tests
* _publish_ - Think Maven deploy
* _publishToMavenLocal_ - Installs the project jar to your local maven cache (aka ~/.m2/repository). Note that Gradle
never uses this, but it can be useful for testing your build with other local Maven-based builds.
* _eclipse_ - Generates an Eclipse project
* _idea_ - Generates an IntelliJ/IDEA project (although the preferred approach is to use IntelliJ's Gradle import).
* _clean_ - Cleans the build directory
Testing and databases
=====================
Testing against a specific database can be achieved in 2 different ways:
Using the "Matrix Testing Plugin" for Gradle.
---------------------------------------------
Coming soon...
Using "profiles"
------------------------
The Hibernate build defines several database testing "profiles" in `databases.gradle`. These
profiles can be activated by name using the `db` build property which can be passed either as
a JVM system prop (`-D`) or as a Gradle project property (`-P`). Examples below use the Gradle
project property approach.
gradle clean build -Pdb=pgsql
To run a test from your IDE, you need to ensure the property expansions happen.
Use the following command:
gradle clean compile -Pdb=pgsql
_*NOTE: If you are running tests against a JDBC driver that is not available via Maven central be sure to add these drivers to your local Maven repo cache (~/.m2/repository) or (better) add it to a personal Maven repo server*_
Running database-specific tests from the IDE using "profiles"
-------------------------------------------------------------
You can run any test on any particular database that is configured in a `databases.gradle` profile.
All you have to do is run the following command:
gradlew setDataBase -Pdb=pgsql
or you can use the shortcut version:
gradlew sDB -Pdb=pgsql
You can do this from the module which you are interested in testing or from the `hibernate-orm` root folder.
Afterward, just pick any test from the IDE and run it as usual. Hibernate will pick the database configuration from the `hibernate.properties`
file that was set up by the `setDataBase` Gradle task.
Starting test databases locally as docker containers
-------------------------------------------------------------
You don't have to install all databases locally to be able to test against them in case you have docker available.
The script `docker_db.sh` allows you to start a pre-configured database which can be used for testing.
All you have to do is run the following command:
./docker_db.sh postgresql_9_5
omitting the argument will print a list of possible options.
When the database is properly started, you can run tests with special profiles that are suffixed with `_ci`
e.g. `pgsql_ci` for PostgreSQL. By using the system property `dbHost` you can configure the IP address of your docker host.
The command for running tests could look like the following:
gradlew test -Pdb=pgsql_ci "-DdbHost=192.168.99.100"

View File

@ -22,11 +22,17 @@ buildscript {
}
}
plugins {
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'nu.studer.credentials' version '2.1'
id 'idea'
id 'org.jetbrains.gradle.plugin.idea-ext' version '0.5'
id 'eclipse'
id 'me.champeau.buildscan-recipes' version '0.2.3'
id 'org.hibernate.build.xjc' version '2.0.1' apply false
id 'org.hibernate.build.maven-repo-auth' version '3.0.3' apply false
id 'org.jetbrains.gradle.plugin.idea-ext' version '0.5'
id 'biz.aQute.bnd' version '5.1.1' apply false
}
@ -40,21 +46,15 @@ allprojects {
dirs "${System.env.ADDITIONAL_REPO}"
}
}
// Needed atm for asciidoclet PR-91, which does not seem to work anyway :(
// todo (6.0) : remove once/if PR-91 ever works and becomes part of asciidoclet proper
maven {
name 'jboss-snapshots-repository'
url 'https://repository.jboss.org/nexus/content/repositories/snapshots'
}
}
apply from: rootProject.file( 'gradle/base-information.gradle' )
apply plugin: 'idea'
apply plugin: 'eclipse'
// minimize changes, at least for now (gradle uses 'build' by default)..
buildDir = "target"
apply from: rootProject.file( 'gradle/base-information.gradle' )
}
@ -84,6 +84,59 @@ task publish {
"themselves if they have any release-related activities to perform"
}
ext {
// look for command-line overrides of the username/password pairs for publishing
if ( project.hasProperty( 'hibernatePublishUsername' ) ) {
credentials.hibernatePublishUsername = project.property( 'hibernatePublishUsername' )
}
if ( project.hasProperty( 'hibernatePublishPassword' ) ) {
credentials.hibernatePublishPassword = project.property( 'hibernatePublishPassword' )
}
if ( project.hasProperty( 'hibernateSnapshotsUsername' ) ) {
credentials.hibernateSnapshotsUsername = project.property( 'hibernateSnapshotsUsername' )
}
if ( project.hasProperty( 'hibernateSnapshotsPassword' ) ) {
credentials.hibernateSnapshotsPassword = project.property( 'hibernateSnapshotsPassword' )
}
}
gradle.taskGraph.addTaskExecutionGraphListener(
new TaskExecutionGraphListener() {
@Override
void graphPopulated(TaskExecutionGraph graph) {
// make sure the needed username/password pair is available based on whether
// we are trying to perform a release or snapshot publishing (if either)
if ( graph.hasTask( 'publishMavenJavaPublicationToSnapshotRepository' ) ) {
if ( ! project.hcannVersion.isSnapshot ) {
throw new GradleException("Cannot publish non-snapshot version to snapshot repository");
}
if ( project.credentials.hibernateSnapshotsUsername == null ) {
throw new GradleException("Snapshot publishing credentials not specified");
}
}
if (graph.hasTask('publishMavenJavaPublicationToOssrhRepository')) {
if ( project.hcannVersion.isSnapshot ) {
throw new GradleException("Cannot publish snapshot version to non-snapshot repository");
}
if (project.credentials.hibernatePublishUsername == null) {
throw new GradleException("Publishing credentials not specified");
}
}
}
}
)
nexusPublishing {
repositories {
sonatype {
username = project.credentials.hibernatePublishUsername
password = project.credentials.hibernatePublishPassword
}
}
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -97,6 +150,10 @@ task ciBuild {
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Misc...
wrapper {
// To upgrade the version of gradle used in the wrapper, run:
// ./gradlew wrapper --gradle-version NEW_VERSION

View File

@ -40,37 +40,34 @@ defaultTasks 'buildDocs'
dependencies {
ext.pressgangVersion = '3.0.0'
compile( libraries.jpa )
compile( project( ':hibernate-core' ) )
annotationProcessor( project( ':hibernate-jpamodelgen' ) )
implementation project( ':hibernate-core' )
testCompile( 'org.apache.commons:commons-lang3:3.4' )
annotationProcessor project( ':hibernate-jpamodelgen' )
testCompile( project(':hibernate-envers') )
testImplementation project(':hibernate-testing')
testImplementation project(':hibernate-envers')
// todo (6.0) - add back hibernate-spatial dependency
// testCompile( project(':hibernate-spatial') )
testCompile( project(path: ':hibernate-core', configuration: 'tests') )
//testImplementation project(':hibernate-spatial')
testImplementation project( ':hibernate-jcache' )
testImplementation libraries.jcache
testImplementation project( path: ':hibernate-core', configuration: 'tests' )
testCompile( project(':hibernate-testing') )
testImplementation 'org.apache.commons:commons-lang3:3.4'
testImplementation 'org.osgi:org.osgi.core:4.3.1'
testCompile "org.osgi:org.osgi.core:4.3.1"
testImplementation libraries.mockito
testImplementation libraries.mockito_inline
testCompile( libraries.mockito )
testCompile( libraries.mockito_inline )
testRuntime( libraries.wildfly_transaction_client )
testRuntime( libraries.h2 )
testRuntime( libraries.hsqldb )
testRuntime( libraries.postgresql )
testRuntime( libraries.mysql )
testRuntime( libraries.mariadb )
testRuntime( libraries.mssql )
testRuntime( libraries.hana )
testRuntime( libraries.cockroachdb )
testRuntime( libraries.firebird )
testCompile( project( ':hibernate-jcache' ) )
testRuntime( libraries.ehcache3 )
testRuntimeOnly libraries.wildfly_transaction_client
testRuntimeOnly libraries.h2
testRuntimeOnly libraries.hsqldb
testRuntimeOnly libraries.postgresql
testRuntimeOnly libraries.mysql
testRuntimeOnly libraries.mariadb
testRuntimeOnly libraries.mssql
testRuntimeOnly libraries.hana
testRuntimeOnly libraries.cockroachdb
testRuntimeOnly libraries.ehcache3
}

View File

@ -7,11 +7,9 @@
apply plugin: 'base'
File versionFile = file( "${rootProject.projectDir}/gradle/version.properties" )
ext {
ormVersionFile = versionFile
ormVersion = HibernateVersion.fromFile( versionFile, project )
ormVersionFile = file( "${rootProject.projectDir}/gradle/version.properties" )
ormVersion = HibernateVersion.fromFile( ormVersionFile, project )
// Override during releases
if ( project.hasProperty( 'releaseVersion' ) ) {
ormVersion = new HibernateVersion( project.releaseVersion, project )

View File

@ -9,8 +9,6 @@
* Support for modules that contain Java code
*/
buildscript {
repositories {
mavenCentral()
@ -23,21 +21,27 @@ buildscript {
import de.thetaphi.forbiddenapis.gradle.CheckForbiddenApis
import org.apache.tools.ant.filters.ReplaceTokens
/**
* Support for modules that contain Java code
*/
apply from: rootProject.file( 'gradle/base-information.gradle' )
apply from: rootProject.file( 'gradle/libraries.gradle' )
apply from: rootProject.file( 'gradle/databases.gradle' )
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'biz.aQute.bnd.builder'
apply plugin: 'checkstyle'
apply plugin: 'build-dashboard'
apply plugin: 'project-report'
ext {
forbiddenAPITargetJDKCompatibility = '11'
}
if ( !project.description ) {
project.description = "The Hibernate ORM $project.name module"
}
// Attempt to leverage JetBrain's Gradle extension to automatically define
// `copyResourcesToIntelliJOutFolder` as a "build trigger" on import.
//
@ -72,64 +76,60 @@ configurations.all*.exclude group: 'xml-apis', module: 'xml-apis'
dependencies {
compile libraries.logging
provided libraries.logging_annotations
annotationProcessor( libraries.logging_processor )
annotationProcessor( libraries.logging )
annotationProcessor( libraries.logging_annotations )
implementation libraries.logging
compileOnly libraries.logging_annotations
// JUnit dependencies made up of:
// * JUnit 5
// * the Jupiter engine which runs JUnit 5 based tests
// * the "vintage" engine - which runs JUnit 3 and 4 based tests
testCompile( libraries.junit5_api )
testRuntime( libraries.junit5_jupiter )
testCompile( libraries.junit5_params )
testCompile( libraries.junit )
testRuntime( libraries.junit5_vintage )
testImplementation libraries.junit5_api
testImplementation libraries.junit5_jupiter
testImplementation libraries.junit5_params
testImplementation libraries.junit
testImplementation libraries.junit5_vintage
testCompile( libraries.byteman )
testCompile( libraries.byteman_install )
testCompile( libraries.byteman_bmunit )
testImplementation libraries.byteman
testImplementation libraries.byteman_install
testImplementation libraries.byteman_bmunit
testRuntime( libraries.log4j )
testRuntime( libraries.javassist )
testRuntime( libraries.byteBuddy )
testRuntimeOnly libraries.log4j
testRuntimeOnly libraries.javassist
testRuntimeOnly libraries.byteBuddy
//Databases
testRuntime( libraries.h2 )
testRuntime( libraries.derby )
testRuntime( libraries.hsqldb )
testRuntime( libraries.postgresql )
testRuntime( libraries.mysql )
testRuntime( libraries.mariadb )
testRuntime( libraries.mssql )
testRuntime( libraries.informix )
testRuntime( libraries.hana )
testRuntime( libraries.cockroachdb )
testRuntime( libraries.firebird )
testRuntime( libraries.oracle )
testRuntimeOnly libraries.h2
testRuntimeOnly libraries.derby
testRuntimeOnly libraries.hsqldb
testRuntimeOnly libraries.postgresql
testRuntimeOnly libraries.mysql
testRuntimeOnly libraries.mariadb
testRuntimeOnly libraries.mssql
testRuntimeOnly libraries.informix
testRuntimeOnly libraries.hana
testRuntimeOnly libraries.cockroachdb
testRuntimeOnly libraries.oracle
// Since both the DB2 driver and HANA have a package "net.jpountz" we have to add dependencies conditionally
// This is due to the "no split-packages" requirement of Java 9+
if ( db.startsWith( 'db2' ) ) {
testRuntime( libraries.db2 )
testRuntimeOnly libraries.db2
}
else if ( db.startsWith( 'hana' ) ) {
testRuntime( libraries.hana )
testRuntimeOnly libraries.hana
}
// Mac-specific
project.ext.toolsJar = file("${System.getProperty('java.home')}/../lib/tools.jar")
if ( project.toolsJar.exists() ) {
testCompile files( project.toolsJar )
testCompileOnly files( project.toolsJar )
}
annotationProcessor libraries.logging_processor
annotationProcessor libraries.logging
annotationProcessor libraries.logging_annotations
}

View File

@ -6,29 +6,17 @@
*/
apply from: rootProject.file( 'gradle/java-module.gradle' )
apply from: rootProject.file( 'gradle/publishing-repos.gradle' )
apply from: rootProject.file( 'gradle/publishing-pom.gradle' )
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Configurations and Dependencies
// Published artifacts (main, sources, javadoc)
configurations {
asciidoclet {
description = 'Dependencies for Asciidoctor Javadoc taglet'
}
ext {
java9ModuleNameBase = project.name.startsWith( 'hibernate-' ) ? name.drop( 'hibernate-'.length() ): name
java9ModuleName = "org.hibernate.orm.$project.java9ModuleNameBase"
}
dependencies {
asciidoclet( libraries.asciidoclet )
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Jar
jar {
manifest {
attributes(
@ -113,7 +101,6 @@ task javadocJar(type: Jar) {
archiveClassifier.set( 'javadoc' )
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Javadoc
@ -131,20 +118,16 @@ javadoc {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Publishing
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
publishedArtifacts {
from components.java
artifact( sourcesJar ) {
// todo : do these really need to be specified twice?
classifier 'sources'
}
artifact( javadocJar ) {
// todo : do these really need to be specified twice?
classifier "javadoc"
}
}
}
}
@ -211,14 +194,12 @@ publishing {
}
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Release / publishing tasks
task ciBuild( dependsOn: [test, publish] )
task release( dependsOn: [test, bintrayUpload] )
bintrayUpload.mustRunAfter test
task release(dependsOn: [test, publishToSonatype])
publishToSonatype.mustRunAfter test
afterEvaluate { Project project ->
project.rootProject.subprojects { Project subproject ->
// NOTE : we want this even when `project == subproject`
project.tasks.bintrayUpload.dependsOn( subproject.tasks.build )
}
}

View File

@ -14,9 +14,8 @@ tasks.withType(GenerateModuleMetadata) {
}
publishing {
publications {
publishedArtifacts {
publishedArtifacts( MavenPublication ) {
pom {
name = 'Hibernate ORM - ' + project.name
description = project.description

View File

@ -1,77 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
apply from: rootProject.file( 'gradle/base-information.gradle' )
apply plugin: 'maven-publish'
apply plugin: 'org.hibernate.build.maven-repo-auth'
apply plugin: 'com.jfrog.bintray'
ext {
bintrayUser = project.findProperty( 'PERSONAL_BINTRAY_USER' )
bintrayKey = project.findProperty( 'PERSONAL_BINTRAY_API_KEY' )
sonatypeOssrhUser = project.findProperty( 'SONATYPE_OSSRH_USER' )
sonatypeOssrhPassword = project.findProperty( 'SONATYPE_OSSRH_PASSWORD' )
}
publishing {
publications {
publishedArtifacts( MavenPublication )
}
repositories {
maven {
name 'jboss-snapshots-repository'
url 'https://repository.jboss.org/nexus/content/repositories/snapshots'
}
}
}
bintray {
user = project.bintrayUser
key = project.bintrayKey
publications = ['publishedArtifacts','relocationArtifacts']
pkg {
userOrg = 'hibernate'
repo = 'artifacts'
name = 'hibernate-orm'
publish = true
version {
name = project.version
description ="Hibernate ORM ${project.version} release. See http://hibernate.org/orm/releases/${project.ormVersion.family}"
released = new Date()
vcsTag = project.version
gpg {
sign = true
}
attributes = [
'jpa': project.jpaVersion.name,
'family': project.ormVersion.family
]
mavenCentralSync {
sync = true
user = project.sonatypeOssrhUser
password = project.sonatypeOssrhPassword
}
}
}
}
model {
tasks.generatePomFileForPublishedArtifactsPublication {
destination = file( "${buildDir}/generated-pom.xml" )
}
}
task generatePomFile( dependsOn: 'generatePomFileForPublishedArtifactsPublication' )

View File

@ -10,12 +10,12 @@ description = 'Integration for Agroal as a ConnectionProvider for Hibernate ORM'
apply from: rootProject.file( 'gradle/published-java-module.gradle' )
dependencies {
compile project( ':hibernate-core' )
compile( libraries.agroal_api )
implementation project( ':hibernate-core' )
implementation libraries.agroal_api
runtime( libraries.agroal_pool )
runtimeOnly libraries.agroal_pool
testCompile project( ':hibernate-testing' )
testCompile( libraries.mockito )
testCompile( libraries.mockito_inline )
testImplementation project( ':hibernate-testing' )
testImplementation libraries.mockito
testImplementation libraries.mockito_inline
}

View File

@ -10,22 +10,22 @@ description = 'Integration for c3p0 Connection pooling into Hibernate ORM'
apply from: rootProject.file( 'gradle/published-java-module.gradle' )
dependencies {
compile project( ':hibernate-core' )
compile( libraries.c3p0 )
implementation project( ':hibernate-core' )
implementation libraries.c3p0
testCompile project( ':hibernate-testing' )
testCompile( libraries.mockito )
testCompile( libraries.mockito_inline )
testImplementation project( ':hibernate-testing' )
testImplementation libraries.mockito
testImplementation libraries.mockito_inline
testCompile( libraries.validator ) {
testImplementation( libraries.validator ) {
// for test runtime
transitive = true
}
// EL libraries are provided scope in Validator
testRuntime( libraries.expression_language )
testRuntimeOnly( libraries.expression_language )
if ( db.equalsIgnoreCase( 'oracle' ) ) {
testRuntime( libraries.oracle )
testRuntimeOnly( libraries.oracle )
}
}

View File

@ -20,11 +20,22 @@ ext {
jaxbTargetDir = file( "${buildDir}/generated-src/jaxb/main" )
}
sourceSets.main {
java.srcDir project.jaxbTargetDir
configurations {
tests {
description = 'Configuration for the produced test jar'
}
javassist {
description "Dependencies for compiling and running the Javassist tests in the `javassist` source-set"
}
}
sourceSets {
main {
// add the XJC generated JAXB classes to the main source-set
java.srcDir project.jaxbTargetDir
}
// resources inherently exclude sources
test {
resources {
@ -32,84 +43,75 @@ sourceSets {
}
}
}
configurations {
tests {
description = 'Configuration for the produced test jar'
testJavassist {
// define the testJavassist source-set
java {
compileClasspath += main.output + test.output + configurations.javassist
runtimeClasspath += main.output + test.output + configurations.javassist
}
}
}
dependencies {
compile( libraries.jpa )
compile( libraries.byteBuddy )
compile( libraries.antlr )
compile( libraries.jta )
compile( libraries.jandex )
compile( libraries.classmate )
compile( libraries.activation )
api libraries.jpa
api libraries.jta
api libraries.jandex
api libraries.classmate
api libraries.commons_annotations
api libraries.jaxb_api
compile( libraries.commons_annotations )
implementation libraries.byteBuddy
implementation libraries.activation
implementation libraries.jaxb_runtime
implementation libraries.antlr
// JAXB
compile( libraries.jaxb_api )
compile( libraries.jaxb_runtime )
compileOnly libraries.jacc
compileOnly libraries.validation
compileOnly libraries.ant
compileOnly libraries.cdi
compileOnly configurations.javassist
// Antlr
antlr( libraries.antlr )
// xjc plugin
xjc( libraries.jaxb_runtime )
xjc( libraries.jaxb_xjc )
xjc( libraries.jaxb2_basics )
xjc( libraries.jaxb2_basics_ant )
xjc( libraries.activation )
provided( libraries.jacc )
provided( libraries.validation )
provided( libraries.ant )
provided( libraries.cdi )
testCompile( project(':hibernate-testing') )
testCompile( libraries.shrinkwrap_api )
testCompile( libraries.shrinkwrap )
testCompile( libraries.jacc )
testCompile( libraries.validation )
testCompile( libraries.jandex )
testCompile( libraries.classmate )
testCompile( libraries.mockito )
testCompile( libraries.mockito_inline )
testCompile( libraries.jodaTime )
testCompile( libraries.assertj )
testCompile( libraries.cdi )
testCompile( libraries.validator ) {
testImplementation project(':hibernate-testing')
testImplementation libraries.shrinkwrap_api
testImplementation libraries.shrinkwrap
testImplementation libraries.shrinkwrap_descriptors_api_javaee
testImplementation libraries.shrinkwrap_descriptors_impl_javaee
testImplementation libraries.jacc
testImplementation libraries.validation
testImplementation( libraries.validator ) {
// for test runtime
transitive = true
}
testImplementation libraries.jandex
testImplementation libraries.classmate
testImplementation libraries.mockito
testImplementation libraries.mockito_inline
testImplementation libraries.jodaTime
testImplementation libraries.assertj
testImplementation libraries.log4j
testImplementation libraries.cdi
testImplementation libraries.jboss_ejb_spec_jar
testImplementation libraries.jboss_annotation_spec_jar
// for testing stored procedure support
testCompile( libraries.derby )
testRuntimeOnly "org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:1.0.0.Final"
testRuntimeOnly libraries.expression_language
testRuntimeOnly 'jaxen:jaxen:1.1'
// testRuntimeOnly libraries.javassist
testRuntimeOnly libraries.byteBuddy
testRuntimeOnly libraries.weld
testRuntimeOnly libraries.atomikos
testRuntimeOnly libraries.atomikos_jta
testRuntimeOnly libraries.wildfly_transaction_client
testRuntime( "org.jboss.spec.javax.ejb:jboss-ejb-api_3.2_spec:1.0.0.Final" )
testRuntime( libraries.expression_language )
testRuntime( 'jaxen:jaxen:1.1' )
testRuntime( libraries.byteBuddy )
testRuntime( libraries.weld )
testRuntime( libraries.atomikos )
testRuntime( libraries.atomikos_jta )
testRuntime(libraries.wildfly_transaction_client)
testAnnotationProcessor project( ':hibernate-jpamodelgen' )
testAnnotationProcessor( project( ':hibernate-jpamodelgen' ) )
testCompile libraries.shrinkwrap_descriptors_api_javaee
testCompile libraries.shrinkwrap_descriptors_impl_javaee
testCompile libraries.jboss_ejb_spec_jar
testCompile libraries.jboss_annotation_spec_jar
antlr libraries.antlr
xjc libraries.jaxb_runtime
xjc libraries.jaxb_xjc
xjc libraries.jaxb2_basics
xjc libraries.jaxb2_basics_ant
xjc libraries.activation
}
jar {

View File

@ -11,19 +11,23 @@ apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply plugin: 'hibernate-matrix-testing'
dependencies {
compile( project( ':hibernate-core' ) ) {
api( project( ':hibernate-core' ) ) {
// Exclude access to this to avoid future use.
// todo (6.0) : this should no longer be transitive from core. Come back and verify this
exclude group: "org.javassist", module: "javassist"
}
implementation libraries.commons_annotations
// TODO HHH-13703: get rid of this dependency
compile( libraries.dom4j )
implementation libraries.dom4j
provided( libraries.ant )
annotationProcessor( project( ':hibernate-jpamodelgen' ) )
compileOnly libraries.ant
testCompile( project( ':hibernate-testing' ) )
testCompile( project( path: ':hibernate-core', configuration: 'tests' ) )
annotationProcessor project( ':hibernate-jpamodelgen' )
testImplementation project( ':hibernate-testing' )
testImplementation project( path: ':hibernate-core', configuration: 'tests' )
}
sourceSets {

View File

@ -12,6 +12,7 @@ apply from: rootProject.file( 'gradle/published-java-module.gradle' )
dependencies {
//No need for transitive dependencies: this is all just metadata to be used as companion jar.
compileOnly project( ':hibernate-core' )
compileOnly( libraries.graalvm_nativeimage )
testCompile( project( ':hibernate-core' ) )
compileOnly libraries.graalvm_nativeimage
testImplementation project( ':hibernate-core' )
}

View File

@ -10,8 +10,9 @@ description = 'Integration for HikariCP into Hibernate O/RM'
apply from: rootProject.file( 'gradle/published-java-module.gradle' )
dependencies {
compile project( ':hibernate-core' )
compile( libraries.hikaricp )
testCompile project( ':hibernate-testing' )
testCompile(libraries.mockito)
implementation project( ':hibernate-core' )
implementation libraries.hikaricp
testImplementation project( ':hibernate-testing' )
testImplementation libraries.mockito
}

View File

@ -7,22 +7,9 @@
description = 'Integration tests for running Hibernate ORM in the Java module path'
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.javamodularity:moduleplugin:1.5.0"
}
}
apply from: rootProject.file( 'gradle/java-module.gradle' )
// No first-class, built-in support for Java modules in Gradle yet,
// so we have to use https://github.com/java9-modularity/gradle-modules-plugin
apply plugin: "org.javamodularity.moduleplugin"
java.modularity.inferModulePath = true
// In this module, the "main" code is actually just test code that happens
// to be built independently so as to generate a Java module.
@ -55,9 +42,9 @@ tasks.compileJava {
checkstyleMain.exclude '**/module-info.java'
dependencies {
compile( project( ':hibernate-core' ) )
compile( project( ':hibernate-envers' ) )
compile( libraries.jpa )
api project( ':hibernate-core' )
api project( ':hibernate-envers' )
implementation libraries.jpa
}
test {

View File

@ -4,11 +4,12 @@ apply from: rootProject.file( 'gradle/published-java-module.gradle' )
dependencies {
compile project( ':hibernate-core' )
compile( libraries.jcache )
implementation project( ':hibernate-core' )
implementation libraries.jcache
testCompile project( ':hibernate-testing' )
testCompile( libraries.mockito )
testCompile( libraries.mockito_inline )
testRuntime( libraries.ehcache3 )
testImplementation project( ':hibernate-testing' )
testImplementation libraries.mockito
testImplementation libraries.mockito_inline
testRuntimeOnly libraries.ehcache3
}

View File

@ -4,14 +4,15 @@ apply from: rootProject.file( 'gradle/published-java-module.gradle' )
dependencies {
compile project( ':hibernate-core' )
compile( libraries.jpa )
compile( libraries.micrometer )
implementation project( ':hibernate-core' )
implementation libraries.jpa
implementation libraries.micrometer
testCompile project( ':hibernate-testing' )
testCompile( libraries.mockito )
testCompile( libraries.mockito_inline )
testAnnotationProcessor( project( ':hibernate-jpamodelgen' ) )
testImplementation project( ':hibernate-testing' )
testImplementation libraries.mockito
testImplementation libraries.mockito_inline
testAnnotationProcessor project( ':hibernate-jpamodelgen' )
}
sourceSets {

View File

@ -11,9 +11,10 @@ apply from: rootProject.file( 'gradle/published-java-module.gradle' )
dependencies {
compile project( ':hibernate-core' )
compile( libraries.proxool )
testCompile project( ':hibernate-testing' )
implementation project( ':hibernate-core' )
implementation libraries.proxool
testImplementation project( ':hibernate-testing' )
}
test {

View File

@ -11,34 +11,30 @@ apply from: rootProject.file( 'gradle/published-java-module.gradle' )
dependencies {
compile project( ':hibernate-core' )
api project( ':hibernate-core' )
compile( libraries.junit )
compile( libraries.junit5_api )
compile( libraries.junit5_params )
compile( 'org.hamcrest:hamcrest-all:1.3' )
api libraries.junit
api libraries.junit5_api
api libraries.junit5_params
api 'org.hamcrest:hamcrest-all:1.3'
api libraries.byteman
api libraries.byteman_install
api libraries.byteman_bmunit
compile( libraries.byteman )
compile( libraries.byteman_install )
compile( libraries.byteman_bmunit )
compile( libraries.xapool )
compile( libraries.log4j )
compile( libraries.jboss_jta ) {
transitive = false;
api libraries.xapool
// api( libraries.jboss_tx_spi ) {
// transitive=false;
// }
api( libraries.jboss_jta ) {
transitive=false;
}
compile( 'javax.money:money-api:1.0.1' )
compile( 'org.javamoney:moneta:1.1' )
annotationProcessor( project( ':hibernate-jpamodelgen' ) )
api 'javax.money:money-api:1.0.1'
api 'org.javamoney:moneta:1.1'
testRuntime( libraries.h2 )
testRuntime( libraries.log4j )
compileOnly libraries.log4j
}
tasks.test.include '**/*'
// todo : Fold into hibernate-core and publish in separate publications
// once http://issues.gradle.org/browse/GRADLE-2966 is resolved;
// that will allow us to keep the same artifactId and publish the pom
// with proper dependencies

View File

@ -11,12 +11,12 @@ apply from: rootProject.file( 'gradle/published-java-module.gradle' )
dependencies {
compile project( ':hibernate-core' )
compile( libraries.vibur )
implementation project( ':hibernate-core' )
implementation libraries.vibur
testCompile( libraries.vibur + ':tests' )
testCompile( 'com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2' )
testCompile project( ':hibernate-testing' )
testCompile( libraries.mockito )
testImplementation project( ':hibernate-testing' )
testImplementation libraries.vibur + ':tests'
testImplementation 'com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2'
testImplementation libraries.mockito
}

22
release/README.adoc Normal file
View File

@ -0,0 +1,22 @@
This project coordinates the tasks that need to be performed as part of creating a release for Hibernate.
== Artifacts
Both snapshot and release artifacts are published to Sonatype https://oss.sonatype.org/[OSSRH].
The "official" detials about OSSRH + Gradle can be found at https://central.sonatype.org/publish/publish-gradle/.
However, its content is way out of date as of the time of this writing.
https://dev.to/kengotoda/deploying-to-ossrh-with-gradle-in-2020-1lhi presents a much better guide. Regardless,
This is all just for background; all of this information is "backed into" the build scripts.
After release, be sure to manage the staging repository created for it on https://oss.sonatype.org/[OSSRH].
== Documentation
JBoss doc server...
== SourceForge
Release bundles (as ZIP and TGZ) are uploaded to https://sourceforge.net/projects/hibernate/files/hibernate-orm/[SourceForge]

View File

@ -21,26 +21,19 @@ processResources {
}
dependencies {
compile( libraries.maven_core ) { transitive = false }
compile( libraries.maven_artifact ) { transitive = false }
compile( libraries.maven_plugin ) { transitive = false }
compile( libraries.maven_plugin_tools ) { transitive = false }
compile( project(':hibernate-core') ) { transitive = false }
compile( libraries.jpa ) { transitive = false }
compile( libraries.javassist ) { transitive = false }
compile( libraries.byteBuddy ) { transitive = false }
compile 'org.codehaus.plexus:plexus-utils:3.0.24'
compile 'org.sonatype.plexus:plexus-build-api:0.0.7'
runtime( libraries.maven_core )
runtime( libraries.maven_artifact )
runtime( libraries.maven_plugin )
runtime( libraries.maven_plugin_tools )
runtime( project(':hibernate-core') )
runtime( libraries.jpa )
runtime( libraries.jta )
runtime( libraries.javassist )
runtime( libraries.byteBuddy )
runtime 'org.codehaus.plexus:plexus-utils:3.0.24'
implementation( project(':hibernate-core') ) { transitive = false }
implementation( libraries.jpa ) { transitive = false }
implementation( libraries.maven_core ) { transitive = false }
implementation( libraries.maven_artifact ) { transitive = false }
implementation( libraries.maven_plugin ) { transitive = false }
implementation( libraries.maven_plugin_tools ) { transitive = false }
implementation 'org.codehaus.plexus:plexus-utils:3.0.24'
implementation 'org.sonatype.plexus:plexus-build-api:0.0.7'
runtimeOnly libraries.maven_core
runtimeOnly libraries.maven_artifact
runtimeOnly libraries.maven_plugin
runtimeOnly libraries.maven_plugin_tools
}
// Inject dependencies into plugin.xml

View File

@ -13,11 +13,9 @@ plugins {
// for portal publishing
id "com.gradle.plugin-publish" version "0.12.0"
id "nu.studer.credentials" version "2.1"
// for publishing snapshots
id 'maven-publish'
id 'org.hibernate.build.maven-repo-auth'
id 'idea'
id 'eclipse'
@ -45,11 +43,10 @@ ext {
}
dependencies {
compile project( ':hibernate-core' )
compile project( ':hibernate-testing' )
implementation( libraries.jpa )
implementation( libraries.javassist )
implementation( libraries.byteBuddy )
implementation project( ':hibernate-core' )
implementation gradleApi()
implementation localGroovy()
}
gradlePlugin {
@ -110,13 +107,6 @@ publishing {
from components.java
}
}
repositories {
maven {
name 'jboss-snapshots-repository'
url 'https://repository.jboss.org/nexus/content/repositories/snapshots'
}
}
}
tasks.withType( GroovyCompile ) {

View File

@ -18,19 +18,17 @@ ext {
}
dependencies {
implementation libraries.jaxb_api
implementation libraries.jaxb_runtime
// JAXB
compile( libraries.jaxb_api )
compile( libraries.jaxb_runtime )
xjc( libraries.jaxb_runtime )
xjc( libraries.jaxb_xjc )
xjc( libraries.jaxb2_basics )
xjc( libraries.jaxb2_basics_ant )
xjc( libraries.activation )
xjc libraries.jaxb_runtime
xjc libraries.jaxb_xjc
xjc libraries.jaxb2_basics
xjc libraries.jaxb2_basics_ant
xjc libraries.activation
testCompile libraries.junit
testCompile libraries.jpa
testCompile project( ':hibernate-core' )
testImplementation project( ':hibernate-core' )
testImplementation libraries.junit
}
sourceSets.main {