Disable deploy step for releases

Whenever the version is set to a release version (like during a
release), the deploy step on the master branch will fail as the version
is not a snapshot (and is attempting to deploy to the snapshots
repository). This refactors some tool usage and checks the maven project
version to prevent this error.
diff --git a/chainsaw/Jenkinsfile b/chainsaw/Jenkinsfile
index c66846d..1645483 100644
--- a/chainsaw/Jenkinsfile
+++ b/chainsaw/Jenkinsfile
@@ -30,12 +30,21 @@
     libraries {
         lib 'logging'
     }
+    tools {
+        jdk 'jdk_8_latest'
+        maven 'maven_3_latest'
+    }
+    environment {
+        PROJECT_VERSION = "${sh(returnStdout: true, script: 'mvn help:evaluate -Dexpression=project.version -q -DforceStdout')}"
+    }
     stages {
         stage('Build') {
             steps {
                 cancelPreviousRunningBuilds()
-                mvn '-Pdevelopment site:site'
-                mvn '-Pdevelopment install'
+                sh '''
+                mvn -Pdevelopment site:site
+                mvn -Pdevelopment install
+                '''
             }
             post {
                 always {
@@ -45,10 +54,13 @@
         }
         stage('Deploy') {
             when {
-                branch 'master'
+                allOf {
+                    branch 'master'
+                    expression { env.PROJECT_VERSION.endsWith('-SNAPSHOT') }
+                }
             }
             steps {
-                mvn '-Pdevelopment -DskipTests deploy'
+                sh 'mvn -Pdevelopment -DskipTests deploy'
             }
             post {
                 fixed {