diff --git a/pom.xml b/pom.xml index e1a189d..9df1649 100644 --- a/pom.xml +++ b/pom.xml @@ -241,5 +241,12 @@ + + + + src/main/resources + true + + diff --git a/src/main/assembly/package.xml b/src/main/assembly/package.xml new file mode 100644 index 0000000..fbaa719 --- /dev/null +++ b/src/main/assembly/package.xml @@ -0,0 +1,44 @@ + + + package + + dir + + false + + + ${project.basedir} + share/doc/kafka-connect-vespa/ + + README* + LICENSE* + NOTICE* + licenses.html + licenses/ + notices/ + + + + ${project.basedir}/config + etc/kafka-connect-vespa + + * + + + + + + share/java/kafka-connect-vespa + true + true + + + org.apache.kafka:connect-api + org.apache.kafka:connect-json + + + + diff --git a/src/main/java/com/vinted/kafka/connect/vespa/VespaSinkConnector.java b/src/main/java/com/vinted/kafka/connect/vespa/VespaSinkConnector.java index 181f438..0686269 100644 --- a/src/main/java/com/vinted/kafka/connect/vespa/VespaSinkConnector.java +++ b/src/main/java/com/vinted/kafka/connect/vespa/VespaSinkConnector.java @@ -1,6 +1,5 @@ package com.vinted.kafka.connect.vespa; -import com.github.jcustenborder.kafka.connect.utils.VersionUtil; import com.github.jcustenborder.kafka.connect.utils.config.Description; import com.github.jcustenborder.kafka.connect.utils.config.DocumentationImportant; import com.github.jcustenborder.kafka.connect.utils.config.DocumentationNote; @@ -58,6 +57,6 @@ public ConfigDef config() { @Override public String version() { - return VersionUtil.version(this.getClass()); + return VespaSinkConnectorVersion.getVersion(); } } diff --git a/src/main/java/com/vinted/kafka/connect/vespa/VespaSinkConnectorVersion.java b/src/main/java/com/vinted/kafka/connect/vespa/VespaSinkConnectorVersion.java new file mode 100644 index 0000000..9043e60 --- /dev/null +++ b/src/main/java/com/vinted/kafka/connect/vespa/VespaSinkConnectorVersion.java @@ -0,0 +1,31 @@ +package com.vinted.kafka.connect.vespa; + + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.InputStream; +import java.util.Properties; + +public class VespaSinkConnectorVersion { + private static final Logger log = LoggerFactory.getLogger(VespaSinkConnectorVersion.class); + private static String version = "unknown"; + + private static final String VERSION_FILE = "/kafka-connect-vespa-version.properties"; + + static { + try { + Properties props = new Properties(); + try (InputStream versionFileStream = VespaSinkConnectorVersion.class.getResourceAsStream(VERSION_FILE)) { + props.load(versionFileStream); + version = props.getProperty("version", version).trim(); + } + } catch (Exception e) { + log.warn("Error while loading version:", e); + } + } + + public static String getVersion() { + return version; + } +} diff --git a/src/main/resources/kafka-connect-vespa-version.properties b/src/main/resources/kafka-connect-vespa-version.properties new file mode 100644 index 0000000..dab37a0 --- /dev/null +++ b/src/main/resources/kafka-connect-vespa-version.properties @@ -0,0 +1,15 @@ +## +# +# Licensed 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. +## +version=${project.version}