Skip to content

Commit

Permalink
added artifact installation script to a local maven repo
Browse files Browse the repository at this point in the history
  • Loading branch information
VladRodionov committed May 22, 2024
1 parent 909ad36 commit b904897
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions install-jar.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# Define the directory and file pattern
TARGET_DIR="./target"
FILE_PATTERN="zstd-jni-*.jar"

# Find the jar file matching the pattern
JAR_FILE=$(find "$TARGET_DIR" -name "$FILE_PATTERN" -print -quit)

# Check if the jar file exists
if [[ -z "$JAR_FILE" ]]; then
echo "Error: No jar file matching the pattern '$FILE_PATTERN' found in '$TARGET_DIR'."
exit 1
fi

# Extract the version from the jar file name
VERSION=$(basename "$JAR_FILE" | sed -n 's/^zstd-jni-\(.*\)\.jar$/\1/p')

# Check if version was extracted successfully
if [[ -z "$VERSION" ]]; then
echo "Error: Unable to extract version from jar file name '$JAR_FILE'."
exit 1
fi

# Run the Maven install command with the extracted version
echo "Installing zstd-jni library to the local maven repository"
mvn install:install-file -Dfile="$JAR_FILE" -DgroupId=com.carrotdata -DartifactId=zstd-jni -Dversion="$VERSION" -Dpackaging=jar

0 comments on commit b904897

Please sign in to comment.