Skip to content

Commit 2868144

Browse files
committed
Make Hibernate ORM and jdbc-derby extensions work without any other required dependencies
With Derby moving to hibernate-community-dialects, Quarkus will need to add this dependency automatically.
1 parent 2240164 commit 2868144

File tree

13 files changed

+221
-2
lines changed

13 files changed

+221
-2
lines changed

bom/application/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,16 @@
11541154
<artifactId>quarkus-hibernate-orm-deployment</artifactId>
11551155
<version>${project.version}</version>
11561156
</dependency>
1157+
<dependency>
1158+
<groupId>io.quarkus</groupId>
1159+
<artifactId>quarkus-hibernate-orm-derby</artifactId>
1160+
<version>${project.version}</version>
1161+
</dependency>
1162+
<dependency>
1163+
<groupId>io.quarkus</groupId>
1164+
<artifactId>quarkus-hibernate-orm-derby-deployment</artifactId>
1165+
<version>${project.version}</version>
1166+
</dependency>
11571167
<dependency>
11581168
<groupId>io.quarkus</groupId>
11591169
<artifactId>quarkus-hibernate-envers</artifactId>

devtools/bom-descriptor-json/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,19 @@
837837
</exclusion>
838838
</exclusions>
839839
</dependency>
840+
<dependency>
841+
<groupId>io.quarkus</groupId>
842+
<artifactId>quarkus-hibernate-orm-derby</artifactId>
843+
<version>${project.version}</version>
844+
<type>pom</type>
845+
<scope>test</scope>
846+
<exclusions>
847+
<exclusion>
848+
<groupId>*</groupId>
849+
<artifactId>*</artifactId>
850+
</exclusion>
851+
</exclusions>
852+
</dependency>
840853
<dependency>
841854
<groupId>io.quarkus</groupId>
842855
<artifactId>quarkus-hibernate-orm-panache</artifactId>

docs/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,19 @@
848848
</exclusion>
849849
</exclusions>
850850
</dependency>
851+
<dependency>
852+
<groupId>io.quarkus</groupId>
853+
<artifactId>quarkus-hibernate-orm-derby-deployment</artifactId>
854+
<version>${project.version}</version>
855+
<type>pom</type>
856+
<scope>test</scope>
857+
<exclusions>
858+
<exclusion>
859+
<groupId>*</groupId>
860+
<artifactId>*</artifactId>
861+
</exclusion>
862+
</exclusions>
863+
</dependency>
851864
<dependency>
852865
<groupId>io.quarkus</groupId>
853866
<artifactId>quarkus-hibernate-orm-panache-deployment</artifactId>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>quarkus-hibernate-orm-derby-parent</artifactId>
7+
<groupId>io.quarkus</groupId>
8+
<version>999-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>quarkus-hibernate-orm-derby-deployment</artifactId>
13+
<name>Quarkus - Hibernate ORM - Derby - Deployment</name>
14+
<description>This extensions is added by Quarkus automatically when quarkus-hibernate-orm and quarkus-jdbc-derby are on the classpath</description>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>io.quarkus</groupId>
19+
<artifactId>quarkus-core-deployment</artifactId>
20+
</dependency>
21+
22+
<dependency>
23+
<groupId>io.quarkus</groupId>
24+
<artifactId>quarkus-hibernate-orm-deployment-spi</artifactId>
25+
</dependency>
26+
<dependency>
27+
<groupId>io.quarkus</groupId>
28+
<artifactId>quarkus-datasource-common</artifactId>
29+
</dependency>
30+
31+
<dependency>
32+
<groupId>io.quarkus</groupId>
33+
<artifactId>quarkus-hibernate-orm-derby</artifactId>
34+
</dependency>
35+
</dependencies>
36+
37+
<build>
38+
<plugins>
39+
<plugin>
40+
<artifactId>maven-compiler-plugin</artifactId>
41+
<executions>
42+
<execution>
43+
<id>default-compile</id>
44+
<configuration>
45+
<annotationProcessorPaths>
46+
<path>
47+
<groupId>io.quarkus</groupId>
48+
<artifactId>quarkus-extension-processor</artifactId>
49+
<version>${project.version}</version>
50+
</path>
51+
</annotationProcessorPaths>
52+
</configuration>
53+
</execution>
54+
</executions>
55+
</plugin>
56+
</plugins>
57+
</build>
58+
59+
60+
</project>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import java.util.Set;
2+
3+
import io.quarkus.datasource.common.runtime.DatabaseKind;
4+
import io.quarkus.deployment.annotations.BuildProducer;
5+
import io.quarkus.deployment.annotations.BuildStep;
6+
import io.quarkus.hibernate.orm.deployment.spi.DatabaseKindDialectBuildItem;
7+
8+
public final class HibernateOrmDerbyProcessor {
9+
@BuildStep
10+
void registerHibernateOrmMetadataForDerbyDialect(BuildProducer<DatabaseKindDialectBuildItem> producer) {
11+
producer.produce(DatabaseKindDialectBuildItem.forCoreDialect(DatabaseKind.DERBY, "Apache Derby",
12+
Set.of("org.hibernate.community.dialect.DerbyDialect")));
13+
}
14+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
6+
<parent>
7+
<artifactId>quarkus-extensions-parent</artifactId>
8+
<groupId>io.quarkus</groupId>
9+
<version>999-SNAPSHOT</version>
10+
<relativePath>../pom.xml</relativePath>
11+
</parent>
12+
<modelVersion>4.0.0</modelVersion>
13+
14+
<artifactId>quarkus-hibernate-orm-derby-parent</artifactId>
15+
<name>Quarkus - Hibernate ORM - Derby - Deployment</name>
16+
<packaging>pom</packaging>
17+
<modules>
18+
<module>runtime</module>
19+
<module>deployment</module>
20+
</modules>
21+
</project>
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>quarkus-hibernate-orm-derby-parent</artifactId>
7+
<groupId>io.quarkus</groupId>
8+
<version>999-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>quarkus-hibernate-orm-derby</artifactId>
13+
<name>Quarkus - Hibernate ORM - Derby - Deployment</name>
14+
<description>This extensions is added by Quarkus automatically when quarkus-hibernate-orm and quarkus-jdbc-derby are on the classpath</description>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>io.quarkus</groupId>
19+
<artifactId>quarkus-core</artifactId>
20+
</dependency>
21+
<dependency>
22+
<groupId>org.hibernate.orm</groupId>
23+
<artifactId>hibernate-community-dialects</artifactId>
24+
</dependency>
25+
</dependencies>
26+
27+
<build>
28+
<plugins>
29+
<plugin>
30+
<groupId>io.quarkus</groupId>
31+
<artifactId>quarkus-extension-maven-plugin</artifactId>
32+
<executions>
33+
<execution>
34+
<phase>compile</phase>
35+
<goals>
36+
<goal>extension-descriptor</goal>
37+
</goals>
38+
<configuration>
39+
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment>
40+
<dependencyCondition>
41+
<artifact>io.quarkus:quarkus-hibernate-orm</artifact>
42+
<artifact>io.quarkus:quarkus-jdbc-derby</artifact>
43+
</dependencyCondition>
44+
</configuration>
45+
</execution>
46+
</executions>
47+
</plugin>
48+
<plugin>
49+
<artifactId>maven-compiler-plugin</artifactId>
50+
<executions>
51+
<execution>
52+
<id>default-compile</id>
53+
<configuration>
54+
<annotationProcessorPaths>
55+
<path>
56+
<groupId>io.quarkus</groupId>
57+
<artifactId>quarkus-extension-processor</artifactId>
58+
<version>${project.version}</version>
59+
</path>
60+
</annotationProcessorPaths>
61+
</configuration>
62+
</execution>
63+
</executions>
64+
</plugin>
65+
</plugins>
66+
</build>
67+
68+
69+
</project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: Quarkus Hibernate ORM Derby
2+
artifact: ${project.groupId}:${project.artifactId}:${project.version}
3+
description: Conditional extension added when Hibernate ORM and the Derby JDBC driver are present
4+
metadata:
5+
unlisted: true
6+

extensions/hibernate-orm/deployment-spi/src/main/java/io/quarkus/hibernate/orm/deployment/spi/DatabaseKindDialectBuildItem.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public final class DatabaseKindDialectBuildItem extends MultiBuildItem {
1919
* @param dbKind The DB Kind set through {@code quarkus.datasource.db-kind}
2020
* @param databaseProductName The corresponding database-product-name to set in Hibernate ORM.
2121
* See {@code org.hibernate.dialect.Database} for information on how this name is resolved to a dialect.
22+
* Also works with {@code org.hibernate.community.dialect.CommunityDatabase} if
23+
* {@code hibernate-community-dialects} is in the classpath.
2224
* @param dialects The corresponding dialects in Hibernate ORM,
2325
* to detect the dbKind when using database multi-tenancy.
2426
*/
@@ -32,6 +34,8 @@ public static DatabaseKindDialectBuildItem forCoreDialect(String dbKind, String
3234
* @param dbKind The DB Kind set through {@code quarkus.datasource.db-kind}
3335
* @param databaseProductName The corresponding database-product-name to set in Hibernate ORM.
3436
* See {@code org.hibernate.dialect.Database} for information on how this name is resolved to a dialect.
37+
* Also works with {@code org.hibernate.community.dialect.CommunityDatabase} if
38+
* {@code hibernate-community-dialects} is in the classpath.
3539
* @param dialects The corresponding dialects in Hibernate ORM,
3640
* to detect the dbKind when using database multi-tenancy.
3741
* @param defaultDatabaseProductVersion The default database-product-version to set in Hibernate ORM.

extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ void registerHibernateOrmMetadataForCoreDialects(
165165
BuildProducer<DatabaseKindDialectBuildItem> producer) {
166166
producer.produce(DatabaseKindDialectBuildItem.forCoreDialect(DatabaseKind.DB2, "DB2",
167167
Set.of("org.hibernate.dialect.DB2Dialect")));
168-
producer.produce(DatabaseKindDialectBuildItem.forCoreDialect(DatabaseKind.DERBY, "Apache Derby",
169-
Set.of("org.hibernate.dialect.DerbyDialect")));
170168
producer.produce(DatabaseKindDialectBuildItem.forCoreDialect(DatabaseKind.H2, "H2",
171169
Set.of("org.hibernate.dialect.H2Dialect"),
172170
// Using our own default version is extra important for H2

extensions/jdbc/jdbc-derby/deployment/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
<artifactId>quarkus-flyway-derby-deployment</artifactId>
3535
<optional>true</optional> <!-- conditional dependency -->
3636
</dependency>
37+
<dependency>
38+
<groupId>io.quarkus</groupId>
39+
<artifactId>quarkus-hibernate-orm-derby-deployment</artifactId>
40+
<optional>true</optional> <!-- conditional dependency -->
41+
</dependency>
3742
<dependency>
3843
<groupId>io.quarkus</groupId>
3944
<artifactId>quarkus-devservices-derby</artifactId>

extensions/jdbc/jdbc-derby/runtime/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
<artifactId>quarkus-flyway-derby</artifactId>
3232
<optional>true</optional> <!-- conditional dependency -->
3333
</dependency>
34+
<dependency>
35+
<groupId>io.quarkus</groupId>
36+
<artifactId>quarkus-hibernate-orm-derby</artifactId>
37+
<optional>true</optional> <!-- conditional dependency -->
38+
</dependency>
3439
<!-- Required for JTA and to reference JDBC drivers by name.
3540
See https://db.apache.org/derby/releases/release-10.15.1.3.cgi#Note%20for%20DERBY-6945
3641
"the derbytools.jar library is now required [...] when using Derby DataSources, and when directly referencing the JDBC drivers" -->

extensions/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
<module>agroal</module>
9696
<module>jdbc</module>
9797
<module>hibernate-orm</module>
98+
<module>hibernate-orm-derby</module>
9899
<module>hibernate-envers</module>
99100
<module>hibernate-reactive</module>
100101
<module>hibernate-validator</module>

0 commit comments

Comments
 (0)