Skip to content
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
21 changes: 19 additions & 2 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ Fork [opensearch-project/OpenSearch](https://github.com/opensearch-project/OpenS

#### JDK

OpenSearch recommends building with the [Temurin/Adoptium](https://adoptium.net/temurin/releases/) distribution. JDK 11 is the minimum supported, and JDK-24 is the newest supported. You must have a supported JDK installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-21`.
OpenSearch recommends building with the [Temurin/Adoptium](https://adoptium.net/temurin/releases/) distribution. JDK 11 is the minimum supported, and JDK-24 is the newest supported. You must have a supported JDK installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-21`.

Download Java 11 from [here](https://adoptium.net/releases.html?variant=openjdk11).
Download Java 11 from [here](https://adoptium.net/releases.html?variant=openjdk11).


In addition, certain backward compatibility tests check out and compile the previous major version of OpenSearch, and therefore require installing [JDK 11](https://adoptium.net/temurin/releases/?version=11) and [JDK 17](https://adoptium.net/temurin/releases/?version=17) and setting the `JAVA11_HOME` and `JAVA17_HOME` environment variables. More to that, since 8.10 release, Gradle has deprecated the usage of the any JDKs below JDK-16. For smooth development experience, the recommendation is to install at least [JDK 17](https://adoptium.net/temurin/releases/?version=17) or [JDK 21](https://adoptium.net/temurin/releases/?version=21). If you still want to build with JDK-11 only, please add `-Dorg.gradle.warning.mode=none` when invoking any Gradle build task from command line, for example:
Expand Down Expand Up @@ -178,6 +178,23 @@ Run OpenSearch using `gradlew run`.
./gradlew run -PinstalledPlugins="['plugin1', 'plugin2']"
```

External plugins may also be fetched and installed from maven snapshots:

```bash
./gradlew run -PinstalledPlugins="['opensearch-job-scheduler', 'opensearch-sql-plugin']"
```

You can specify a plugin version to pull to test a specific version in the org.opensearch.plugin groupId:
```bash
./gradlew run -PinstalledPlugins="['opensearch-job-scheduler:3.3.x.x']"
```

or install with fully qualified maven coordinates:
```bash
./gradlew run -PinstalledPlugins="['com.example:my-cool-plugin:3.3.x.x']"
```


That will build OpenSearch and start it, writing its log above Gradle's status message. We log a lot of stuff on startup, specifically these lines tell you that OpenSearch is ready.

```
Expand Down
40 changes: 39 additions & 1 deletion gradle/run.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* under the License.
*/
import org.opensearch.gradle.testclusters.RunTask
import org.opensearch.gradle.VersionProperties

apply plugin: 'opensearch.testclusters'

Expand All @@ -41,8 +42,45 @@ testClusters {
if (numNodes > 1) numberOfNodes = numNodes
if (findProperty("installedPlugins")) {
installedPlugins = Eval.me(installedPlugins)

def resolveMavenPlugin = { coords ->
// Add default groupId if not fully qualified (less than 2 colons)
String[] parts = coords.split(':')
if (parts.length == 2 && parts[0].contains('.')) {
throw new IllegalArgumentException("version is required if groupdId is specified '${coords}' Use format: groupId:artifactId:version")
}
String fullCoords = parts.length < 3 ? 'org.opensearch.plugin:' + coords : coords
def config = project.configurations.detachedConfiguration(
project.dependencies.create(fullCoords)
)
config.resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
plugin(project.layout.file(project.provider { config.singleFile }))
}

for (String p : installedPlugins) {
plugin('plugins:'.concat(p))
// check if its a local plugin first
if (project.findProject(':plugins:' + p) != null) {
plugin('plugins:' + p)
} else {
// attempt to fetch it from maven
project.repositories.mavenLocal()
project.repositories {
maven {
name = 'OpenSearch Snapshots'
url = 'https://central.sonatype.com/repository/maven-snapshots/'
}
}
if (p.contains(':')) {
// Maven coordinates with version specified
String coords = p.contains('@') ? p : (p + '@zip')
resolveMavenPlugin(coords)
} else {
// Not found locally, try Maven with current OS version + 0
String version = VersionProperties.getOpenSearch().replace('-SNAPSHOT', '.0-SNAPSHOT')
String coords = p + ':' + version + '@zip'
resolveMavenPlugin(coords)
}
}
if (p.equals("arrow-flight-rpc")) {
// Add system properties for Netty configuration
systemProperty 'io.netty.allocator.numDirectArenas', '1'
Expand Down
Loading