2 missed a $
source | link

Assuming the workspace is persistent, here's a thing to trigger after each build:

if [ -f counterfile.txt ]; then
  num=$(cat counterfile.txt)
else
  num=0
fi
num=$((num+1))
echo num>counterfile$num>counterfile.txt

filename=$POM_ARTIFACTID-$POM-VERSION.jar
newfilename=echo $filename | sed "s/-SNAPSHOT/-$num-SNAPSHOT/"
mv $filename $newfilename

Assuming the workspace is persistent, here's a thing to trigger after each build:

if [ -f counterfile.txt ]; then
  num=$(cat counterfile.txt)
else
  num=0
fi
num=$((num+1))
echo num>counterfile.txt

filename=$POM_ARTIFACTID-$POM-VERSION.jar
newfilename=echo $filename | sed "s/-SNAPSHOT/-$num-SNAPSHOT/"
mv $filename $newfilename

Assuming the workspace is persistent, here's a thing to trigger after each build:

if [ -f counterfile.txt ]; then
  num=$(cat counterfile.txt)
else
  num=0
fi
num=$((num+1))
echo $num>counterfile.txt

filename=$POM_ARTIFACTID-$POM-VERSION.jar
newfilename=echo $filename | sed "s/-SNAPSHOT/-$num-SNAPSHOT/"
mv $filename $newfilename
1
source | link

Assuming the workspace is persistent, here's a thing to trigger after each build:

if [ -f counterfile.txt ]; then
  num=$(cat counterfile.txt)
else
  num=0
fi
num=$((num+1))
echo num>counterfile.txt

filename=$POM_ARTIFACTID-$POM-VERSION.jar
newfilename=echo $filename | sed "s/-SNAPSHOT/-$num-SNAPSHOT/"
mv $filename $newfilename