Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only start Elasticsearch Dev Services for Hibernate Search if the default backend is in use #24012

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public final class DevservicesElasticsearchBuildItem extends MultiBuildItem {
private final String version;
private final Distribution distribution;

public DevservicesElasticsearchBuildItem(String configItemName) {
this.hostsConfigProperty = configItemName;
public DevservicesElasticsearchBuildItem(String hostsConfigProperty) {
this.hostsConfigProperty = hostsConfigProperty;
this.version = null;
this.distribution = Distribution.ELASTIC;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,12 +342,16 @@ private void registerReflectionForGson(BuildProducer<ReflectiveClassBuildItem> r
@BuildStep
DevservicesElasticsearchBuildItem devServices(HibernateSearchElasticsearchBuildTimeConfig buildTimeConfig) {
if (buildTimeConfig.defaultPersistenceUnit != null && buildTimeConfig.defaultPersistenceUnit.defaultBackend != null
// If the version is not set, the default backend is not in use.
&& buildTimeConfig.defaultPersistenceUnit.defaultBackend.version.isPresent()) {
ElasticsearchVersion version = buildTimeConfig.defaultPersistenceUnit.defaultBackend.version.get();
return new DevservicesElasticsearchBuildItem("quarkus.hibernate-search-orm.elasticsearch.hosts",
version.versionString(),
DevservicesElasticsearchBuildItem.Distribution.valueOf(version.distribution().toString().toUpperCase()));
} else {
// Currently we only start dev-services for the default backend of the default persistence unit.
// See https://github.com/quarkusio/quarkus/issues/24011
return null;
}
return new DevservicesElasticsearchBuildItem("quarkus.hibernate-search-orm.elasticsearch.hosts");
}
}