diff --git a/build.gradle b/build.gradle index 8a08474d17..04728a0a21 100644 --- a/build.gradle +++ b/build.gradle @@ -162,6 +162,7 @@ configurations { dependencies { implementation "org.opensearch.plugin:geo:${opensearch_version}" api project(":libs:h3") + api project(":geospatial-common") yamlRestTestRuntimeOnly "org.apache.logging.log4j:log4j-core:${versions.log4j}" testImplementation "org.hamcrest:hamcrest:${versions.hamcrest}" testImplementation 'org.json:json:20231013' diff --git a/common/build.gradle b/common/build.gradle new file mode 100644 index 0000000000..3fcb256675 --- /dev/null +++ b/common/build.gradle @@ -0,0 +1,35 @@ +plugins { + id 'java' + id 'maven-publish' + +} + +group = 'org.opensearch' +version = '3.0.0.0-SNAPSHOT' + +repositories { + mavenLocal() + maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } + mavenCentral() + maven { url "https://plugins.gradle.org/m2/" } +} + +dependencies { + testImplementation platform('org.junit:junit-bom:5.10.0') + testImplementation 'org.junit.jupiter:junit-jupiter' +} + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } + repositories { + mavenLocal() + } +} + +test { + useJUnitPlatform() +} \ No newline at end of file diff --git a/common/src/main/java/org/opensearch/CommonMain.java b/common/src/main/java/org/opensearch/CommonMain.java new file mode 100644 index 0000000000..e32de89d57 --- /dev/null +++ b/common/src/main/java/org/opensearch/CommonMain.java @@ -0,0 +1,11 @@ +package org.opensearch; + +public class CommonMain { + + public final static String TEST_STR = "TEST"; + + public static void main(String[] args) { + + System.out.println("Hello world!"); + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 72251801a7..5a76591554 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,4 +10,7 @@ rootProject.name = 'geospatial' include ":libs" -include ":libs:h3" \ No newline at end of file +include ":libs:h3" + +include 'common' +project(":common").name = rootProject.name + "-common" diff --git a/src/main/java/org/opensearch/geospatial/plugin/GeospatialPlugin.java b/src/main/java/org/opensearch/geospatial/plugin/GeospatialPlugin.java index d64f20b4f7..68a949b5ac 100644 --- a/src/main/java/org/opensearch/geospatial/plugin/GeospatialPlugin.java +++ b/src/main/java/org/opensearch/geospatial/plugin/GeospatialPlugin.java @@ -13,6 +13,7 @@ import java.util.Map; import java.util.function.Supplier; +import org.opensearch.CommonMain; import org.opensearch.action.ActionRequest; import org.opensearch.client.Client; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; @@ -220,6 +221,7 @@ public List getRestHandlers( new ActionHandler<>(UpdateDatasourceAction.INSTANCE, UpdateDatasourceTransportAction.class), new ActionHandler<>(DeleteDatasourceAction.INSTANCE, DeleteDatasourceTransportAction.class) ); + String testStr = CommonMain.TEST_STR; List> allHandlers = new ArrayList<>(); allHandlers.addAll(geoJsonHandlers);