Skip to content

Commit dd8e186

Browse files
committed
HHH-18644 - New and improved hibernate-maven-plugin
1 parent 356b7f5 commit dd8e186

File tree

39 files changed

+310
-1024
lines changed

39 files changed

+310
-1024
lines changed

documentation/documentation.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ dependencies {
137137
reportAggregation project(':hibernate-spatial')
138138
reportAggregation project(':hibernate-vibur')
139139
reportAggregation project(':hibernate-ant')
140-
reportAggregation project(':hibernate-enhance-maven-plugin')
140+
reportAggregation project(':hibernate-maven-plugin')
141141
reportAggregation project(':hibernate-processor')
142142

143143
asciidoctorGems 'rubygems:rouge:4.1.1'

gradle/published-java-module.gradle

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -33,71 +33,6 @@ java {
3333
withSourcesJar()
3434
}
3535

36-
publishing {
37-
publications {
38-
// main publication
39-
publishedArtifacts {
40-
from components.java
41-
}
42-
43-
// relocation for the published artifacts based on the old groupId
44-
relocationPom( MavenPublication ) {
45-
pom {
46-
name = project.name + ' - relocation'
47-
groupId = 'org.hibernate'
48-
artifactId = project.name
49-
version = project.version
50-
51-
description = project.description
52-
url = 'https://hibernate.org/orm'
53-
54-
organization {
55-
name = 'Hibernate.org'
56-
url = 'https://hibernate.org'
57-
}
58-
59-
licenses {
60-
license {
61-
name = 'GNU Library General Public License v2.1 or later'
62-
url = 'https://www.opensource.org/licenses/LGPL-2.1'
63-
comments = 'See discussion at https://hibernate.org/community/license/ for more details.'
64-
distribution = 'repo'
65-
}
66-
}
67-
68-
scm {
69-
url = 'https://github.com/hibernate/hibernate-orm'
70-
connection = 'scm:git:https://github.com/hibernate/hibernate-orm.git'
71-
developerConnection = 'scm:git:git@github.com:hibernate/hibernate-orm.git'
72-
}
73-
74-
developers {
75-
developer {
76-
id = 'hibernate-team'
77-
name = 'The Hibernate Development Team'
78-
organization = 'Hibernate.org'
79-
organizationUrl = 'https://hibernate.org'
80-
}
81-
}
82-
83-
issueManagement {
84-
system = 'jira'
85-
url = 'https://hibernate.atlassian.net/browse/HHH'
86-
}
87-
88-
distributionManagement {
89-
relocation {
90-
groupId = 'org.hibernate.orm'
91-
artifactId = project.name
92-
version = project.version
93-
}
94-
}
95-
}
96-
}
97-
}
98-
}
99-
100-
10136
var signingKey = resolveSigningKey()
10237
var signingPassword = findSigningProperty( "signingPassword" )
10338

@@ -237,7 +172,6 @@ tasks.release.dependsOn tasks.test, tasks.publishToSonatype
237172
tasks.preVerifyRelease.dependsOn build
238173
tasks.preVerifyRelease.dependsOn generateMetadataFileForPublishedArtifactsPublication
239174
tasks.preVerifyRelease.dependsOn generatePomFileForPublishedArtifactsPublication
240-
tasks.preVerifyRelease.dependsOn generatePomFileForRelocationPomPublication
241175

242176
tasks.publishToSonatype.mustRunAfter test
243177

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* Hibernate, Relational Persistence for Idiomatic Java
3+
*
4+
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
5+
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
6+
*/
7+
apply from: rootProject.file( 'gradle/published-java-module.gradle' )
8+
9+
publishing {
10+
publications {
11+
// main publication
12+
publishedArtifacts {
13+
from components.java
14+
}
15+
16+
// relocation for the published artifacts based on the old groupId
17+
relocationPom( MavenPublication ) {
18+
pom {
19+
name = project.name + ' - relocation'
20+
groupId = 'org.hibernate'
21+
artifactId = project.name
22+
version = project.version
23+
24+
description = project.description
25+
url = 'https://hibernate.org/orm'
26+
27+
organization {
28+
name = 'Hibernate.org'
29+
url = 'https://hibernate.org'
30+
}
31+
32+
licenses {
33+
license {
34+
name = 'GNU Library General Public License v2.1 or later'
35+
url = 'https://www.opensource.org/licenses/LGPL-2.1'
36+
comments = 'See discussion at https://hibernate.org/community/license/ for more details.'
37+
distribution = 'repo'
38+
}
39+
}
40+
41+
scm {
42+
url = 'https://github.com/hibernate/hibernate-orm'
43+
connection = 'scm:git:https://github.com/hibernate/hibernate-orm.git'
44+
developerConnection = 'scm:git:git@github.com:hibernate/hibernate-orm.git'
45+
}
46+
47+
developers {
48+
developer {
49+
id = 'hibernate-team'
50+
name = 'The Hibernate Development Team'
51+
organization = 'Hibernate.org'
52+
organizationUrl = 'https://hibernate.org'
53+
}
54+
}
55+
56+
issueManagement {
57+
system = 'jira'
58+
url = 'https://hibernate.atlassian.net/browse/HHH'
59+
}
60+
61+
distributionManagement {
62+
relocation {
63+
groupId = 'org.hibernate.orm'
64+
artifactId = project.name
65+
version = project.version
66+
}
67+
}
68+
}
69+
}
70+
}
71+
}
72+
73+
tasks.preVerifyRelease.dependsOn generatePomFileForRelocationPomPublication

hibernate-agroal/hibernate-agroal.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

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

1212
dependencies {
1313
implementation project( ':hibernate-core' )

hibernate-c3p0/hibernate-c3p0.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

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

1212
dependencies {
1313
implementation project( ':hibernate-core' )

hibernate-community-dialects/hibernate-community-dialects.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
description = 'Hibernate\'s community supported dialects'
99

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

1212
dependencies {
1313
api project( ':hibernate-core' )

hibernate-core/hibernate-core.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ plugins {
1212

1313
description = 'Hibernate\'s core ORM functionality'
1414

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

hibernate-envers/hibernate-envers.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

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

1313
dependencies {

hibernate-graalvm/hibernate-graalvm.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

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

1212
dependencies {
1313
//No need for transitive dependencies: this is all just metadata to be used as companion jar.

hibernate-hikaricp/hibernate-hikaricp.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

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

1212
dependencies {
1313
implementation project( ':hibernate-core' )

hibernate-jcache/hibernate-jcache.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
description = 'Integration for javax.cache into Hibernate as a second-level caching service'
22

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

55
dependencies {
66
api project( ':hibernate-core' )

hibernate-jfr/hibernate-jfr.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

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

1212
dependencies {
1313
implementation project( ':hibernate-core' )

hibernate-micrometer/hibernate-micrometer.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
description = 'Integration for Micrometer metrics into Hibernate as a metrics collection package'
22

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

55
dependencies {
66
implementation project( ':hibernate-core' )

hibernate-platform/hibernate-platform.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dependencies {
3232

3333
api project( ":hibernate-processor" )
3434
api project( ":hibernate-gradle-plugin" )
35-
api project( ":hibernate-enhance-maven-plugin" )
35+
api project( ":hibernate-maven-plugin" )
3636
api project( ":hibernate-ant" )
3737

3838
api libs.hibernateModels

hibernate-proxool/hibernate-proxool.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

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

1212

1313
dependencies {

hibernate-spatial/hibernate-spatial.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

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

1313

hibernate-testing/hibernate-testing.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
description = 'Support for testing Hibernate ORM functionality'
99

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

1212
dependencies {
1313
api project( ':hibernate-core' )

hibernate-ucp/hibernate-ucp.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

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

1212
dependencies {
1313
implementation project( ':hibernate-core' )

hibernate-vector/hibernate-vector.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

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

1212
dependencies {
1313
api project( ':hibernate-core' )

hibernate-vibur/hibernate-vibur.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

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

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

1212
dependencies {
1313
implementation project( ':hibernate-core' )

local-build-plugins/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ dependencies {
2222
implementation 'jakarta.json:jakarta.json-api:2.0.1'
2323
implementation 'org.eclipse:yasson:2.0.4'
2424
implementation 'org.jsoup:jsoup:1.15.3'
25+
26+
implementation "org.apache.maven:maven-embedder:3.9.9"
27+
implementation "org.apache.maven:maven-compat:3.9.9"
28+
implementation "org.apache.maven.resolver:maven-resolver-connector-basic:1.9.18"
29+
implementation "org.apache.maven.resolver:maven-resolver-transport-http:1.9.18"
2530
}
2631

2732
tasks.compileJava {
@@ -80,6 +85,10 @@ gradlePlugin {
8085
id = 'org.hibernate.orm.build.java-module'
8186
implementationClass = 'org.hibernate.orm.toolchains.JavaModulePlugin'
8287
}
88+
register( "mavenEmbedder" ) {
89+
id = "org.hibernate.build.maven-embedder"
90+
implementationClass = "org.hibernate.build.maven.embedder.MavenEmbedderPlugin"
91+
}
8392
}
8493
}
8594

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package org.hibernate.build.maven.embedder;
2+
3+
import org.gradle.api.Project;
4+
import org.gradle.api.file.DirectoryProperty;
5+
6+
import javax.inject.Inject;
7+
8+
/**
9+
* Gradle DSL extension for configuring the {@linkplain MavenEmbedderPlugin maven-embedder plugin}
10+
*
11+
* @author Steve Ebersole
12+
*/
13+
public class MavenEmbedderConfig {
14+
private DirectoryProperty localRepositoryDirectory;
15+
16+
@Inject
17+
public MavenEmbedderConfig(Project project) {
18+
localRepositoryDirectory = project.getObjects().directoryProperty();
19+
localRepositoryDirectory.convention( project.getLayout().getBuildDirectory().dir( "maven-embedder/maven-local" ) );
20+
}
21+
22+
public DirectoryProperty getLocalRepositoryDirectory() {
23+
return localRepositoryDirectory;
24+
}
25+
26+
public void setLocalRepositoryDirectory(DirectoryProperty localRepositoryDirectory) {
27+
this.localRepositoryDirectory = localRepositoryDirectory;
28+
}
29+
}

0 commit comments

Comments
 (0)