Skip to content

Commit

Permalink
HSEARCH-3696 Run Elasticsearch on a different JDK in the JDK13 Jenkin…
Browse files Browse the repository at this point in the history
…sfile build

Elasticsearch 6 doesn't work with JDK13 yet, and ES5 probably never will.
  • Loading branch information
yrodiere committed Sep 12, 2019
1 parent dfdfbbb commit 3b69c81
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Jenkinsfile
Expand Up @@ -168,7 +168,9 @@ stage('Configure') {
// See http://www.oracle.com/technetwork/java/javase/eol-135779.html
new JdkITEnvironment(version: '8', tool: 'OpenJDK 8 Latest', status: ITEnvironmentStatus.USED_IN_DEFAULT_BUILD),
new JdkITEnvironment(version: '11', tool: 'OpenJDK 11 Latest', status: ITEnvironmentStatus.SUPPORTED),
new JdkITEnvironment(version: '13', tool: 'OpenJDK 13 Latest', status: ITEnvironmentStatus.EXPERIMENTAL)
new JdkITEnvironment(version: '13', tool: 'OpenJDK 13 Latest', status: ITEnvironmentStatus.EXPERIMENTAL,
// Elasticsearch won't run on JDK13
elasticsearchTool: 'OpenJDK 11 Latest')
],
database: [
new DatabaseITEnvironment(dbName: 'h2', mavenProfile: 'h2', status: ITEnvironmentStatus.USED_IN_DEFAULT_BUILD),
Expand Down Expand Up @@ -418,9 +420,11 @@ stage('Non-default environment ITs') {
environments.content.jdk.enabled.each { JdkITEnvironment itEnv ->
executions.put(itEnv.tag, {
node(NODE_PATTERN_BASE) {
def elasticsearchJdkTool = itEnv.elasticsearchTool ? tool(name: itEnv.elasticsearchTool, type: 'jdk') : null
helper.withMavenWorkspace(jdk: itEnv.tool) {
mavenNonDefaultIT itEnv, """ \
clean install --fail-at-end \
${elasticsearchJdkTool ? "-Dtest.elasticsearch.java_home=$elasticsearchJdkTool" : ""} \
"""
}
}
Expand Down Expand Up @@ -580,6 +584,7 @@ abstract class ITEnvironment {
class JdkITEnvironment extends ITEnvironment {
String version
String tool
String elasticsearchTool
String getTag() { "jdk-$version" }
}

Expand Down
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -119,6 +119,13 @@ You will need to execute something along the lines of:

> mvn integration-test -pl elasticsearch -Dtest.elasticsearch.host.provided=true -Dtest.elasticsearch.host.url=<The full URL of your Elasticsearch endpoint> -Dtest.elasticsearch.host.aws.access_key=<Your access key> -Dtest.elasticsearch.host.aws.secret_key=<Your secret key> -Dtest.elasticsearch.host.aws.region=<Your AWS region ID>

When building Hibernate Search with new JDKs, you may want to run Elasticsearch with a different JDK than the one used by Maven.
This can be done by setting a property
(**this will only work with the profiles for Elasticsearch 5 and above**):

> mvn clean install -Dtest.elasticsearch.java_home=/path/to/my/jdk


### Contributing

New contributors are always welcome. We collected some helpful hints on how to get started
Expand Down
7 changes: 7 additions & 0 deletions pom.xml
Expand Up @@ -286,6 +286,7 @@

<!-- Elasticsearch tests properties -->

<test.elasticsearch.java_home>${java.home}</test.elasticsearch.java_home>
<test.elasticsearch.host.url>http://localhost:9200</test.elasticsearch.host.url>
<test.elasticsearch.host.username></test.elasticsearch.host.username>
<test.elasticsearch.host.password></test.elasticsearch.host.password>
Expand Down Expand Up @@ -2450,6 +2451,9 @@
<pathConf>${project.build.directory}/elasticsearch-maven-plugin/5.0/configuration/</pathConf>
<pathInitScript>${project.build.directory}/elasticsearch-maven-plugin/5.0/init/init.script</pathInitScript>
<autoCreateIndex>false</autoCreateIndex>
<environmentVariables>
<JAVA_HOME>${test.elasticsearch.java_home}</JAVA_HOME>
</environmentVariables>
</configuration>
<!-- Different executions from 2.x: the "start" goal has been renamed in version 5 -->
<executions>
Expand Down Expand Up @@ -2501,6 +2505,9 @@
<pathConf>${project.build.directory}/elasticsearch-maven-plugin/5.0/configuration/</pathConf>
<pathInitScript>${project.build.directory}/elasticsearch-maven-plugin/5.0/init/init.script</pathInitScript>
<autoCreateIndex>false</autoCreateIndex>
<environmentVariables>
<JAVA_HOME>${test.elasticsearch.java_home}</JAVA_HOME>
</environmentVariables>
</configuration>
<!-- Different executions from 2.x: the "start" goal has been renamed in version 5 -->
<executions>
Expand Down

0 comments on commit 3b69c81

Please sign in to comment.