diff --git a/gradle/app-version.gradle b/gradle/app-version.gradle
index 2367ef4006a7789f8bb00b7402d326522a5f04f9..f7e96ed1e21cc2211ce833d495462f485030fcaf 100644
--- a/gradle/app-version.gradle
+++ b/gradle/app-version.gradle
@@ -2,23 +2,27 @@ apply plugin: "com.palantir.git-version"
 
 tasks.withType(JavaCompile) {
   doFirst {
-    def versionFile = new File("${projectDir}/src/main/resources/version/nshmp-haz-version.json")
-    new File(versionFile.getParent()).mkdirs()
-    def details = versionDetails()
-    def ciProjectUrl = System.getenv("CI_PROJECT_URL")
-    def branch = System.getenv("CI_COMMIT_BRANCH")
-    def versionInfo = [
-      branchName: branch ? branch : details.branchName,
-      commitDistance: details.commitDistance,
-      gitHash:  details.gitHash,
-      gitHashFull:  details.gitHashFull,
-      isCleanTag:  details.isCleanTag,
-      lastTag:  details.lastTag,
-      projectName: project.name,
-      url: ciProjectUrl ? ciProjectUrl : 'git config --get remote.origin.url'.execute().text.replace('\n', ''),
-      version: details.version,
-    ]
-    def json = groovy.json.JsonOutput.toJson(versionInfo)
-    versionFile.write(groovy.json.JsonOutput.prettyPrint(json))
+    try {
+      def versionFile = new File("${projectDir}/src/main/resources/version/nshmp-haz-version.json")
+      new File(versionFile.getParent()).mkdirs()
+      def details = versionDetails()
+      def ciProjectUrl = System.getenv("CI_PROJECT_URL")
+      def branch = System.getenv("CI_COMMIT_BRANCH")
+      def versionInfo = [
+        branchName: branch ? branch : details.branchName,
+        commitDistance: details.commitDistance,
+        gitHash:  details.gitHash,
+        gitHashFull:  details.gitHashFull,
+        isCleanTag:  details.isCleanTag,
+        lastTag:  details.lastTag,
+        projectName: project.name,
+        url: ciProjectUrl ? ciProjectUrl : "git config --get remote.origin.url".execute().text.replace("\n", ""),
+        version: details.version,
+      ]
+      def json = groovy.json.JsonOutput.toJson(versionInfo)
+      versionFile.write(groovy.json.JsonOutput.prettyPrint(json))
+    } catch (Exception e) {
+      println("Failed to create version file.")
+    }
   }
 }