From a06badba77ec7fc098878e2852ffdf5a24b8d1ac Mon Sep 17 00:00:00 2001 From: kezhenxu94 Date: Wed, 1 Sep 2021 00:32:55 +0800 Subject: [PATCH] Enhance `StandaloneServer` so that we don't need to update the version number manually (#6074) --- .../server/StandaloneServer.java | 10 +++++++++ .../src/main/resources/registry.properties | 22 ------------------- 2 files changed, 10 insertions(+), 22 deletions(-) delete mode 100644 dolphinscheduler-standalone-server/src/main/resources/registry.properties diff --git a/dolphinscheduler-standalone-server/src/main/java/org/apache/dolphinscheduler/server/StandaloneServer.java b/dolphinscheduler-standalone-server/src/main/java/org/apache/dolphinscheduler/server/StandaloneServer.java index 3b92b7f7cb..d52e7f5354 100644 --- a/dolphinscheduler-standalone-server/src/main/java/org/apache/dolphinscheduler/server/StandaloneServer.java +++ b/dolphinscheduler-standalone-server/src/main/java/org/apache/dolphinscheduler/server/StandaloneServer.java @@ -33,6 +33,7 @@ import org.apache.curator.test.TestingServer; import java.io.FileReader; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import javax.sql.DataSource; @@ -71,6 +72,15 @@ public class StandaloneServer { final TestingServer server = new TestingServer(true); System.setProperty("registry.servers", server.getConnectString()); + final Path registryPath = Paths.get( + StandaloneServer.class.getProtectionDomain().getCodeSource().getLocation().getPath(), + "../../../dolphinscheduler-registry-plugin/dolphinscheduler-registry-zookeeper/pom.xml" + ).toAbsolutePath(); + if (Files.exists(registryPath)) { + System.setProperty("registry.plugin.binding", registryPath.toString()); + System.setProperty("registry.plugin.dir", ""); + } + Thread.currentThread().setName("Standalone-Server"); new SpringApplicationBuilder( diff --git a/dolphinscheduler-standalone-server/src/main/resources/registry.properties b/dolphinscheduler-standalone-server/src/main/resources/registry.properties deleted file mode 100644 index 3f557ce033..0000000000 --- a/dolphinscheduler-standalone-server/src/main/resources/registry.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# This file is only to override the production configurations in standalone server. - -registry.plugin.dir=./dolphinscheduler-dist/target/dolphinscheduler-dist-1.3.6-SNAPSHOT/lib/plugin/registry/zookeeper -registry.plugin.name=zookeeper -registry.servers=127.0.0.1:2181