diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java
index 8c44ab56..6cd770fb 100644
--- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java
+++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java
@@ -49,6 +49,16 @@ public abstract class AbstractCompileMojo extends AbstractGroovySourcesMojo {
*/
protected static final Version GROOVY_5_0_0_ALPHA1 = new Version(5, 0, 0, "alpha-1");
+ /**
+ * Groovy 4.0.11 version.
+ */
+ protected static final Version GROOVY_4_0_21 = new Version(4, 0, 21);
+
+ /**
+ * Groovy 4.0.11 version.
+ */
+ protected static final Version GROOVY_4_0_16 = new Version(4, 0, 16);
+
/**
* Groovy 4.0.11 version.
*/
@@ -198,6 +208,11 @@ public abstract class AbstractCompileMojo extends AbstractGroovySourcesMojo {
*
16
* 17
* 18
+ * 19
+ * 20
+ * 21
+ * 22
+ * 23
*
* Using 1.6 (or 6) or 1.7 (or 7) requires Groovy >= 2.1.3.
* Using 1.8 (or 8) requires Groovy >= 2.3.3.
@@ -213,6 +228,8 @@ public abstract class AbstractCompileMojo extends AbstractGroovySourcesMojo {
* Using 19 requires Groovy > 4.0.2.
* Using 20 requires Groovy > 4.0.6.
* Using 21 requires Groovy > 4.0.11.
+ * Using 22 requires Groovy > 4.0.16.
+ * Using 23 requires Groovy > 4.0.21.
*/
@Parameter(property = "maven.compiler.target", defaultValue = "1.8")
protected String targetBytecode;
@@ -509,7 +526,15 @@ protected void verifyGroovyVersionSupportsTargetBytecode() {
}
}
- if ("21".equals(targetBytecode)) {
+ if ("23".equals(targetBytecode)) {
+ if (groovyOlderThan(GROOVY_4_0_21)) {
+ throw new IllegalArgumentException("Target bytecode " + targetBytecode + " requires Groovy " + GROOVY_4_0_21 + " or newer.");
+ }
+ } else if ("22".equals(targetBytecode)) {
+ if (groovyOlderThan(GROOVY_4_0_16)) {
+ throw new IllegalArgumentException("Target bytecode " + targetBytecode + " requires Groovy " + GROOVY_4_0_16 + " or newer.");
+ }
+ } else if ("21".equals(targetBytecode)) {
if (groovyOlderThan(GROOVY_4_0_11)) {
throw new IllegalArgumentException("Target bytecode " + targetBytecode + " requires Groovy " + GROOVY_4_0_11 + " or newer.");
}
diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java
index dc3f5142..9ba55b71 100644
--- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java
+++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java
@@ -51,6 +51,16 @@ public abstract class AbstractGenerateStubsMojo extends AbstractGroovyStubSource
*/
protected static final Version GROOVY_5_0_0_ALPHA1 = new Version(5, 0, 0, "alpha-1");
+ /**
+ * Groovy 4.0.11 version.
+ */
+ protected static final Version GROOVY_4_0_21 = new Version(4, 0, 21);
+
+ /**
+ * Groovy 4.0.11 version.
+ */
+ protected static final Version GROOVY_4_0_16 = new Version(4, 0, 16);
+
/**
* Groovy 4.0.11 version.
*/
@@ -195,6 +205,11 @@ public abstract class AbstractGenerateStubsMojo extends AbstractGroovyStubSource
* 16
* 17
* 18
+ * 19
+ * 20
+ * 21
+ * 22
+ * 23
*
* Using 1.6 (or 6) or 1.7 (or 7) requires Groovy >= 2.1.3.
* Using 1.8 (or 8) requires Groovy >= 2.3.3.
@@ -210,6 +225,8 @@ public abstract class AbstractGenerateStubsMojo extends AbstractGroovyStubSource
* Using 19 requires Groovy > 4.0.2.
* Using 20 requires Groovy > 4.0.6.
* Using 21 requires Groovy > 4.0.11.
+ * Using 22 requires Groovy > 4.0.16.
+ * Using 23 requires Groovy > 4.0.21.
*
* @since 1.0-beta-3
*/
@@ -430,7 +447,15 @@ protected void verifyGroovyVersionSupportsTargetBytecode() {
}
}
- if ("21".equals(targetBytecode)) {
+ if ("23".equals(targetBytecode)) {
+ if (groovyOlderThan(GROOVY_4_0_21)) {
+ throw new IllegalArgumentException("Target bytecode " + targetBytecode + " requires Groovy " + GROOVY_4_0_21 + " or newer.");
+ }
+ } else if ("22".equals(targetBytecode)) {
+ if (groovyOlderThan(GROOVY_4_0_16)) {
+ throw new IllegalArgumentException("Target bytecode " + targetBytecode + " requires Groovy " + GROOVY_4_0_16 + " or newer.");
+ }
+ } else if ("21".equals(targetBytecode)) {
if (groovyOlderThan(GROOVY_4_0_11)) {
throw new IllegalArgumentException("Target bytecode " + targetBytecode + " requires Groovy " + GROOVY_4_0_11 + " or newer.");
}
diff --git a/src/test/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojoTest.java b/src/test/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojoTest.java
index b2b69271..f2e643e9 100644
--- a/src/test/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojoTest.java
+++ b/src/test/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojoTest.java
@@ -402,6 +402,13 @@ public void testJava20WithSupportedGroovy() {
testMojo.verifyGroovyVersionSupportsTargetBytecode();
}
+ @Test(expected = IllegalArgumentException.class)
+ public void testJava21WithUnsupportedGroovy() {
+ testMojo = new TestMojo("4.0.10");
+ testMojo.targetBytecode = "21";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
@Test
public void testJava21WithSupportedGroovy() {
testMojo = new TestMojo("4.0.11");
@@ -409,6 +416,34 @@ public void testJava21WithSupportedGroovy() {
testMojo.verifyGroovyVersionSupportsTargetBytecode();
}
+ @Test(expected = IllegalArgumentException.class)
+ public void testJava22WithUnsupportedGroovy() {
+ testMojo = new TestMojo("4.0.15");
+ testMojo.targetBytecode = "22";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
+ @Test
+ public void testJava22WithSupportedGroovy() {
+ testMojo = new TestMojo("4.0.16");
+ testMojo.targetBytecode = "22";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testJava23WithUnsupportedGroovy() {
+ testMojo = new TestMojo("4.0.210");
+ testMojo.targetBytecode = "23";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
+ @Test
+ public void testJava23WithSupportedGroovy() {
+ testMojo = new TestMojo("4.0.21");
+ testMojo.targetBytecode = "23";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
@Test(expected = IllegalArgumentException.class)
public void testUnrecognizedJava() {
testMojo = new TestMojo("2.1.2");
diff --git a/src/test/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojoTest.java b/src/test/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojoTest.java
index f4a9897a..133bdd3a 100644
--- a/src/test/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojoTest.java
+++ b/src/test/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojoTest.java
@@ -432,6 +432,13 @@ public void testJava20WithSupportedGroovy() {
testMojo.verifyGroovyVersionSupportsTargetBytecode();
}
+ @Test(expected = IllegalArgumentException.class)
+ public void testJava21WithUnsupportedGroovy() {
+ testMojo = new TestMojo("4.0.10");
+ testMojo.targetBytecode = "21";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
@Test
public void testJava21WithSupportedGroovy() {
testMojo = new TestMojo("4.0.11");
@@ -439,6 +446,34 @@ public void testJava21WithSupportedGroovy() {
testMojo.verifyGroovyVersionSupportsTargetBytecode();
}
+ @Test(expected = IllegalArgumentException.class)
+ public void testJava22WithUnsupportedGroovy() {
+ testMojo = new TestMojo("4.0.15");
+ testMojo.targetBytecode = "22";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
+ @Test
+ public void testJava22WithSupportedGroovy() {
+ testMojo = new TestMojo("4.0.16");
+ testMojo.targetBytecode = "22";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testJava23WithUnsupportedGroovy() {
+ testMojo = new TestMojo("4.0.210");
+ testMojo.targetBytecode = "23";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
+ @Test
+ public void testJava23WithSupportedGroovy() {
+ testMojo = new TestMojo("4.0.21");
+ testMojo.targetBytecode = "23";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
@Test(expected = IllegalArgumentException.class)
public void testUnrecognizedJava() {
testMojo = new TestMojo("2.1.2");