Maven
Extract settings from a Maven project
# evaluate the current version string into a variable (obviously you can use other properties than 'project.version')
export VERSION=$(mvn -q -DforceStdout org.apache.maven.plugins:maven-help-plugin:3.3.0:evaluate -Dexpression=project.version)
# this little part allows to get rid of a '-SNAPSHOT' suffix
export RELEASEVERSION=${VERSION/-SNAPSHOT/}
# alternative which replaces the suffix
# export RELEASEVERSION=${VERSION/-SNAPSHOT/-REPLACEMENT}