Skip to content

Commit

Permalink
HHH-18644 - New and improved hibernate-maven-plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
sebersole committed Oct 22, 2024
1 parent 356b7f5 commit dd8e186
Show file tree
Hide file tree
Showing 39 changed files with 310 additions and 1,024 deletions.
2 changes: 1 addition & 1 deletion documentation/documentation.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ dependencies {
reportAggregation project(':hibernate-spatial')
reportAggregation project(':hibernate-vibur')
reportAggregation project(':hibernate-ant')
reportAggregation project(':hibernate-enhance-maven-plugin')
reportAggregation project(':hibernate-maven-plugin')
reportAggregation project(':hibernate-processor')

asciidoctorGems 'rubygems:rouge:4.1.1'
Expand Down
66 changes: 0 additions & 66 deletions gradle/published-java-module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,71 +33,6 @@ java {
withSourcesJar()
}

publishing {
publications {
// main publication
publishedArtifacts {
from components.java
}

// relocation for the published artifacts based on the old groupId
relocationPom( MavenPublication ) {
pom {
name = project.name + ' - relocation'
groupId = 'org.hibernate'
artifactId = project.name
version = project.version

description = project.description
url = 'https://hibernate.org/orm'

organization {
name = 'Hibernate.org'
url = 'https://hibernate.org'
}

licenses {
license {
name = 'GNU Library General Public License v2.1 or later'
url = 'https://www.opensource.org/licenses/LGPL-2.1'
comments = 'See discussion at https://hibernate.org/community/license/ for more details.'
distribution = 'repo'
}
}

scm {
url = 'https://github.com/hibernate/hibernate-orm'
connection = 'scm:git:https://github.com/hibernate/hibernate-orm.git'
developerConnection = 'scm:git:[email protected]:hibernate/hibernate-orm.git'
}

developers {
developer {
id = 'hibernate-team'
name = 'The Hibernate Development Team'
organization = 'Hibernate.org'
organizationUrl = 'https://hibernate.org'
}
}

issueManagement {
system = 'jira'
url = 'https://hibernate.atlassian.net/browse/HHH'
}

distributionManagement {
relocation {
groupId = 'org.hibernate.orm'
artifactId = project.name
version = project.version
}
}
}
}
}
}


var signingKey = resolveSigningKey()
var signingPassword = findSigningProperty( "signingPassword" )

Expand Down Expand Up @@ -237,7 +172,6 @@ tasks.release.dependsOn tasks.test, tasks.publishToSonatype
tasks.preVerifyRelease.dependsOn build
tasks.preVerifyRelease.dependsOn generateMetadataFileForPublishedArtifactsPublication
tasks.preVerifyRelease.dependsOn generatePomFileForPublishedArtifactsPublication
tasks.preVerifyRelease.dependsOn generatePomFileForRelocationPomPublication

tasks.publishToSonatype.mustRunAfter test

Expand Down
73 changes: 73 additions & 0 deletions gradle/relocated-published-java-module.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* 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/published-java-module.gradle' )

publishing {
publications {
// main publication
publishedArtifacts {
from components.java
}

// relocation for the published artifacts based on the old groupId
relocationPom( MavenPublication ) {
pom {
name = project.name + ' - relocation'
groupId = 'org.hibernate'
artifactId = project.name
version = project.version

description = project.description
url = 'https://hibernate.org/orm'

organization {
name = 'Hibernate.org'
url = 'https://hibernate.org'
}

licenses {
license {
name = 'GNU Library General Public License v2.1 or later'
url = 'https://www.opensource.org/licenses/LGPL-2.1'
comments = 'See discussion at https://hibernate.org/community/license/ for more details.'
distribution = 'repo'
}
}

scm {
url = 'https://github.com/hibernate/hibernate-orm'
connection = 'scm:git:https://github.com/hibernate/hibernate-orm.git'
developerConnection = 'scm:git:[email protected]:hibernate/hibernate-orm.git'
}

developers {
developer {
id = 'hibernate-team'
name = 'The Hibernate Development Team'
organization = 'Hibernate.org'
organizationUrl = 'https://hibernate.org'
}
}

issueManagement {
system = 'jira'
url = 'https://hibernate.atlassian.net/browse/HHH'
}

distributionManagement {
relocation {
groupId = 'org.hibernate.orm'
artifactId = project.name
version = project.version
}
}
}
}
}
}

tasks.preVerifyRelease.dependsOn generatePomFileForRelocationPomPublication
2 changes: 1 addition & 1 deletion hibernate-agroal/hibernate-agroal.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

description = 'Integration for Agroal as a ConnectionProvider for Hibernate ORM'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )

dependencies {
implementation project( ':hibernate-core' )
Expand Down
2 changes: 1 addition & 1 deletion hibernate-c3p0/hibernate-c3p0.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

description = 'Integration for c3p0 Connection pooling into Hibernate ORM'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )

dependencies {
implementation project( ':hibernate-core' )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

description = 'Hibernate\'s community supported dialects'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )

dependencies {
api project( ':hibernate-core' )
Expand Down
2 changes: 1 addition & 1 deletion hibernate-core/hibernate-core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {

description = 'Hibernate\'s core ORM functionality'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )
apply plugin: 'org.hibernate.orm.antlr'
apply plugin: 'org.hibernate.matrix-test'

Expand Down
2 changes: 1 addition & 1 deletion hibernate-envers/hibernate-envers.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

description = 'Hibernate\'s entity version (audit/history) support'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )
apply plugin: 'org.hibernate.matrix-test'

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion hibernate-graalvm/hibernate-graalvm.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

description = "Experimental extension to make it easier to compile applications into a GraalVM native image"

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )

dependencies {
//No need for transitive dependencies: this is all just metadata to be used as companion jar.
Expand Down
2 changes: 1 addition & 1 deletion hibernate-hikaricp/hibernate-hikaricp.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

description = 'Integration for HikariCP into Hibernate O/RM'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )

dependencies {
implementation project( ':hibernate-core' )
Expand Down
2 changes: 1 addition & 1 deletion hibernate-jcache/hibernate-jcache.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
description = 'Integration for javax.cache into Hibernate as a second-level caching service'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )

dependencies {
api project( ':hibernate-core' )
Expand Down
2 changes: 1 addition & 1 deletion hibernate-jfr/hibernate-jfr.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

description = 'Integration for JDK JFR into Hibernate O/RM'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )

dependencies {
implementation project( ':hibernate-core' )
Expand Down
2 changes: 1 addition & 1 deletion hibernate-micrometer/hibernate-micrometer.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
description = 'Integration for Micrometer metrics into Hibernate as a metrics collection package'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )

dependencies {
implementation project( ':hibernate-core' )
Expand Down
2 changes: 1 addition & 1 deletion hibernate-platform/hibernate-platform.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ dependencies {

api project( ":hibernate-processor" )
api project( ":hibernate-gradle-plugin" )
api project( ":hibernate-enhance-maven-plugin" )
api project( ":hibernate-maven-plugin" )
api project( ":hibernate-ant" )

api libs.hibernateModels
Expand Down
2 changes: 1 addition & 1 deletion hibernate-proxool/hibernate-proxool.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

description = 'Integration for Proxool Connection pooling into Hibernate O/RM'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )


dependencies {
Expand Down
2 changes: 1 addition & 1 deletion hibernate-spatial/hibernate-spatial.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

description = 'Integrate support for Spatial/GIS data into Hibernate O/RM'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )
apply plugin: 'org.hibernate.matrix-test'


Expand Down
2 changes: 1 addition & 1 deletion hibernate-testing/hibernate-testing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

description = 'Support for testing Hibernate ORM functionality'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )

dependencies {
api project( ':hibernate-core' )
Expand Down
2 changes: 1 addition & 1 deletion hibernate-ucp/hibernate-ucp.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

description = 'Integration for Oracle UCP into Hibernate O/RM'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )

dependencies {
implementation project( ':hibernate-core' )
Expand Down
2 changes: 1 addition & 1 deletion hibernate-vector/hibernate-vector.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

description = 'Hibernate\'s extensions for vector support'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )

dependencies {
api project( ':hibernate-core' )
Expand Down
2 changes: 1 addition & 1 deletion hibernate-vibur/hibernate-vibur.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

description = 'Integration for Vibur Connection pooling as a Hibernate ORM ConnectionProvider'

apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply from: rootProject.file( 'gradle/relocated-published-java-module.gradle' )

dependencies {
implementation project( ':hibernate-core' )
Expand Down
9 changes: 9 additions & 0 deletions local-build-plugins/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ dependencies {
implementation 'jakarta.json:jakarta.json-api:2.0.1'
implementation 'org.eclipse:yasson:2.0.4'
implementation 'org.jsoup:jsoup:1.15.3'

implementation "org.apache.maven:maven-embedder:3.9.9"
implementation "org.apache.maven:maven-compat:3.9.9"
implementation "org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18"
implementation "org.apache.maven.resolver:maven-resolver-transport-http:1.9.18"
}

tasks.compileJava {
Expand Down Expand Up @@ -80,6 +85,10 @@ gradlePlugin {
id = 'org.hibernate.orm.build.java-module'
implementationClass = 'org.hibernate.orm.toolchains.JavaModulePlugin'
}
register( "mavenEmbedder" ) {
id = "org.hibernate.build.maven-embedder"
implementationClass = "org.hibernate.build.maven.embedder.MavenEmbedderPlugin"
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.hibernate.build.maven.embedder;

import org.gradle.api.Project;
import org.gradle.api.file.DirectoryProperty;

import javax.inject.Inject;

/**
* Gradle DSL extension for configuring the {@linkplain MavenEmbedderPlugin maven-embedder plugin}
*
* @author Steve Ebersole
*/
public class MavenEmbedderConfig {
private DirectoryProperty localRepositoryDirectory;

@Inject
public MavenEmbedderConfig(Project project) {
localRepositoryDirectory = project.getObjects().directoryProperty();
localRepositoryDirectory.convention( project.getLayout().getBuildDirectory().dir( "maven-embedder/maven-local" ) );
}

public DirectoryProperty getLocalRepositoryDirectory() {
return localRepositoryDirectory;
}

public void setLocalRepositoryDirectory(DirectoryProperty localRepositoryDirectory) {
this.localRepositoryDirectory = localRepositoryDirectory;
}
}
Loading

0 comments on commit dd8e186

Please sign in to comment.