diff --git a/src/main/java/org/codehaus/gmavenplus/util/ClassWrangler.java b/src/main/java/org/codehaus/gmavenplus/util/ClassWrangler.java index f503fecf..f841f14d 100644 --- a/src/main/java/org/codehaus/gmavenplus/util/ClassWrangler.java +++ b/src/main/java/org/codehaus/gmavenplus/util/ClassWrangler.java @@ -124,7 +124,7 @@ public Version getGroovyVersion() { try { return Version.parseFromString(getGroovyVersionString()); } catch (Exception e) { - throw new RuntimeException("Unable to determine Groovy version. Is Groovy declared as a dependency?"); + throw new GroovyVersionException("Unable to determine Groovy version. Is Groovy declared as a dependency?", e); } } @@ -259,7 +259,7 @@ protected String getGroovyJar() { return groovyJar; } catch (ClassNotFoundException e) { - throw new RuntimeException("Unable to determine Groovy version. Is Groovy declared as a dependency?"); + throw new GroovyVersionException("Unable to determine Groovy version. Is Groovy declared as a dependency?", e); } } diff --git a/src/main/java/org/codehaus/gmavenplus/util/GroovyVersionException.java b/src/main/java/org/codehaus/gmavenplus/util/GroovyVersionException.java new file mode 100644 index 00000000..104d9344 --- /dev/null +++ b/src/main/java/org/codehaus/gmavenplus/util/GroovyVersionException.java @@ -0,0 +1,30 @@ +package org.codehaus.gmavenplus.util; + +/** + * Exception thrown when Groovy version cannot be determined. + * + * @author Keegan Witt + * @since 4.3.2 + */ +public class GroovyVersionException extends RuntimeException { + + /** + * Constructs a new GroovyVersionException with the specified message. + * + * @param message the detail message + */ + public GroovyVersionException(final String message) { + super(message); + } + + /** + * Constructs a new GroovyVersionException with the specified message and cause. + * + * @param message the detail message + * @param cause the cause + */ + public GroovyVersionException(final String message, final Throwable cause) { + super(message, cause); + } + +}