diff --git a/pom.xml b/pom.xml
index c2b853804..04534aea7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.codehaus.gmavenplus
gmavenplus-plugin
maven-plugin
- 1.8.2-SNAPSHOT
+ 1.9.0-SNAPSHOT
UTF-8
diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java
index 5ef9d306b..f67a45338 100644
--- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java
+++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojo.java
@@ -40,6 +40,16 @@
*/
public abstract class AbstractCompileMojo extends AbstractGroovySourcesMojo {
+ /**
+ * Groovy 3.0.3 version.
+ */
+ protected static final Version GROOVY_3_0_3 = new Version(3, 0, 3);
+
+ /**
+ * Groovy 3.0.0 beta-2 version.
+ */
+ protected static final Version GROOVY_3_0_0_BETA2 = new Version(3, 0, 0, "beta-2");
+
/**
* Groovy 3.0.0 beta-1 version.
*/
@@ -129,6 +139,8 @@ public abstract class AbstractCompileMojo extends AbstractGroovySourcesMojo {
* 11
* 12
* 13
+ * 14
+ * 15
*
* Using 1.6 or 1.7 requires Groovy >= 2.1.3.
* Using 1.8 requires Groovy >= 2.3.3.
@@ -136,10 +148,20 @@ public abstract class AbstractCompileMojo extends AbstractGroovySourcesMojo {
* Using 9 with invokedynamic requires Groovy >= 2.5.3, or Groovy >= 3.0.0 alpha 2, but not any 2.6 versions.
* Using 10, 11, or 12 requires Groovy >= 2.5.3, or Groovy >= 3.0.0 alpha 4, but not any 2.6 versions.
* Using 13 requires Groovy >= 2.5.7, or Groovy >= 3.0.0-beta-1, but not any 2.6 versions.
+ * Using 14 requires Groovy >= 3.0.0 beta-2.
+ * Using 15 requires Groovy >= 3.0.3.
*/
@Parameter(property = "maven.compiler.target", defaultValue = "1.8")
protected String targetBytecode;
+ /**
+ * Whether to check that the version of Groovy used is able to use the requested targetBytecode
.
+ *
+ * @since 1.9.0
+ */
+ @Parameter(property = "skipBytecodeCheck", defaultValue = "false")
+ protected boolean skipBytecodeCheck;
+
/**
* Whether Groovy compiler should be set to debug.
*/
@@ -242,7 +264,7 @@ protected synchronized void doCompile(final Set sources, final List classp
logPluginClasspath();
classWrangler.logGroovyVersion(mojoExecution.getMojoDescriptor().getGoal());
- if (groovyVersionSupportsAction()) {
+ if (groovyVersionSupportsAction() && !skipBytecodeCheck) {
verifyGroovyVersionSupportsTargetBytecode();
} else {
getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support compilation. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping compiling.");
@@ -396,7 +418,15 @@ protected Object setupCompilerConfiguration(final File compileOutputDirectory, f
* org.codehaus.groovy.classgen.asm.WriterController.
*/
protected void verifyGroovyVersionSupportsTargetBytecode() {
- if ("13".equals(targetBytecode)) {
+ if ("15".equals(targetBytecode)) {
+ if (groovyOlderThan(GROOVY_3_0_3)) {
+ throw new IllegalArgumentException("Target bytecode 15 requires Groovy " + GROOVY_3_0_3 + " or newer.");
+ }
+ } else if ("14".equals(targetBytecode)) {
+ if (groovyOlderThan(GROOVY_3_0_0_BETA2)) {
+ throw new IllegalArgumentException("Target bytecode 14 requires Groovy " + GROOVY_3_0_0_BETA2 + " or newer.");
+ }
+ } else if ("13".equals(targetBytecode)) {
if (groovyOlderThan(GROOVY_2_5_7) || (groovyAtLeast(GROOVY_2_6_0_ALPHA1) && groovyOlderThan(GROOVY_3_0_0_BETA1))) {
throw new IllegalArgumentException("Target bytecode 13 requires Groovy " + GROOVY_2_5_7 + "/" + GROOVY_3_0_0_BETA1 + " or newer. No 2.6 version is supported.");
}
diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java
index 52b2fb1a3..a6e03ae20 100644
--- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java
+++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojo.java
@@ -44,6 +44,16 @@ public abstract class AbstractGenerateStubsMojo extends AbstractGroovyStubSource
* (although it does create the target directory) when I use other versions.
*/
+ /**
+ * Groovy 3.0.3 version.
+ */
+ protected static final Version GROOVY_3_0_3 = new Version(3, 0, 3);
+
+ /**
+ * Groovy 3.0.0 beta-2 version.
+ */
+ protected static final Version GROOVY_3_0_0_BETA2 = new Version(3, 0, 0, "beta-2");
+
/**
* Groovy 3.0.0 beta-1 version.
*/
@@ -133,6 +143,8 @@ public abstract class AbstractGenerateStubsMojo extends AbstractGroovyStubSource
* 11
* 12
* 13
+ * 14
+ * 15
*
* Using 1.6 or 1.7 requires Groovy >= 2.1.3.
* Using 1.8 requires Groovy >= 2.3.3.
@@ -140,12 +152,22 @@ public abstract class AbstractGenerateStubsMojo extends AbstractGroovyStubSource
* Using 9 with invokedynamic requires Groovy >= 2.5.3, or Groovy >= 3.0.0 alpha 2, but not any 2.6 versions.
* Using 10, 11, or 12 requires Groovy >= 2.5.3, or Groovy >= 3.0.0 alpha 4, but not any 2.6 versions.
* Using 13 requires Groovy >= 2.5.7, or Groovy >= 3.0.0-beta-1, but not any 2.6 versions.
+ * Using 14 requires Groovy >= 3.0.0 beta-2.
+ * Using 15 requires Groovy >= 3.0.3.
*
* @since 1.0-beta-3
*/
@Parameter(property = "maven.compiler.target", defaultValue = "1.8")
protected String targetBytecode;
+ /**
+ * Whether to check that the version of Groovy used is able to use the requested targetBytecode
.
+ *
+ * @since 1.9.0
+ */
+ @Parameter(property = "skipBytecodeCheck", defaultValue = "false")
+ protected boolean skipBytecodeCheck;
+
/**
* Whether Groovy compiler should be set to debug.
*/
@@ -226,7 +248,7 @@ protected synchronized void doStubGeneration(final Set stubSources, final
logPluginClasspath();
classWrangler.logGroovyVersion(mojoExecution.getMojoDescriptor().getGoal());
- if (groovyVersionSupportsAction()) {
+ if (groovyVersionSupportsAction() && !skipBytecodeCheck) {
verifyGroovyVersionSupportsTargetBytecode();
} else {
getLog().error("Your Groovy version (" + classWrangler.getGroovyVersionString() + ") doesn't support stub generation. The minimum version of Groovy required is " + minGroovyVersion + ". Skipping stub generation.");
@@ -364,7 +386,15 @@ protected void resetStubModifiedDates(final Set stubs) {
* org.codehaus.groovy.classgen.asm.WriterController.
*/
protected void verifyGroovyVersionSupportsTargetBytecode() {
- if ("13".equals(targetBytecode)) {
+ if ("15".equals(targetBytecode)) {
+ if (groovyOlderThan(GROOVY_3_0_3)) {
+ throw new IllegalArgumentException("Target bytecode 15 requires Groovy " + GROOVY_3_0_3 + " or newer.");
+ }
+ } else if ("14".equals(targetBytecode)) {
+ if (groovyOlderThan(GROOVY_3_0_0_BETA2)) {
+ throw new IllegalArgumentException("Target bytecode 14 requires Groovy " + GROOVY_3_0_0_BETA2 + " or newer.");
+ }
+ } else if ("13".equals(targetBytecode)) {
if (groovyOlderThan(GROOVY_2_5_7) || (groovyAtLeast(GROOVY_2_6_0_ALPHA1) && groovyOlderThan(GROOVY_3_0_0_BETA1))) {
throw new IllegalArgumentException("Target bytecode 13 requires Groovy " + GROOVY_2_5_7 + "/" + GROOVY_3_0_0_BETA1 + " or newer. No 2.6 version is supported.");
}
diff --git a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyDocMojo.java b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyDocMojo.java
index 586fdc864..d069535f8 100644
--- a/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyDocMojo.java
+++ b/src/main/java/org/codehaus/gmavenplus/mojo/AbstractGroovyDocMojo.java
@@ -137,7 +137,7 @@ public abstract class AbstractGroovyDocMojo extends AbstractGroovySourcesMojo {
*
* @since 1.6
*/
- @Parameter(property = "maven.groovydoc.skip", defaultValue = "false")
+ @Parameter(property = "skipGroovydoc", defaultValue = "false")
protected boolean skipGroovyDoc;
/**
@@ -168,7 +168,7 @@ public abstract class AbstractGroovyDocMojo extends AbstractGroovySourcesMojo {
*/
protected synchronized void doGroovyDocGeneration(final FileSet[] sourceDirectories, final List> classpath, final File outputDirectory) throws ClassNotFoundException, InvocationTargetException, IllegalAccessException, InstantiationException, MalformedURLException {
if (skipGroovyDoc) {
- getLog().info("Skipping generation of GroovyDoc because ${maven.groovydoc.skip} was set to true.");
+ getLog().info("Skipping generation of GroovyDoc because ${skipGroovydoc} was set to true.");
return;
}
diff --git a/src/test/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojoTest.java b/src/test/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojoTest.java
index 4b38868f3..da39d9930 100644
--- a/src/test/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojoTest.java
+++ b/src/test/java/org/codehaus/gmavenplus/mojo/AbstractCompileMojoTest.java
@@ -278,6 +278,34 @@ public void testJava13WithSupportedGroovy3() {
testMojo.verifyGroovyVersionSupportsTargetBytecode();
}
+ @Test(expected = IllegalArgumentException.class)
+ public void testJava14WithUnsupportedGroovy() {
+ testMojo = new TestMojo("3.0.0-beta-1");
+ testMojo.targetBytecode = "14";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
+ @Test
+ public void testJava14WithSupportedGroovy() {
+ testMojo = new TestMojo("3.0.0-beta-2");
+ testMojo.targetBytecode = "14";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testJava15WithUnsupportedGroovy() {
+ testMojo = new TestMojo("3.0.2");
+ testMojo.targetBytecode = "15";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
+ @Test
+ public void testJava15WithSupportedGroovy() {
+ testMojo = new TestMojo("3.0.3");
+ testMojo.targetBytecode = "15";
+ 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 fa35ffebf..753d74515 100644
--- a/src/test/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojoTest.java
+++ b/src/test/java/org/codehaus/gmavenplus/mojo/AbstractGenerateStubsMojoTest.java
@@ -314,6 +314,34 @@ public void testJava13WithSupportedGroovy3() {
testMojo.verifyGroovyVersionSupportsTargetBytecode();
}
+ @Test(expected = IllegalArgumentException.class)
+ public void testJava14WithUnsupportedGroovy() {
+ testMojo = new TestMojo("3.0.0-beta-1");
+ testMojo.targetBytecode = "14";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
+ @Test
+ public void testJava14WithSupportedGroovy() {
+ testMojo = new TestMojo("3.0.0-beta-2");
+ testMojo.targetBytecode = "14";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testJava15WithUnsupportedGroovy() {
+ testMojo = new TestMojo("3.0.2");
+ testMojo.targetBytecode = "15";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
+ @Test
+ public void testJava15WithSupportedGroovy() {
+ testMojo = new TestMojo("3.0.3");
+ testMojo.targetBytecode = "15";
+ testMojo.verifyGroovyVersionSupportsTargetBytecode();
+ }
+
protected static class TestMojo extends AbstractGenerateStubsMojo {
protected TestMojo() {
this(GROOVY_1_8_2.toString(), false);