diff --git a/src/it/setup-custom-toolchain/pom.xml b/src/it/setup-custom-toolchain/pom.xml
index 476de67..5119530 100644
--- a/src/it/setup-custom-toolchain/pom.xml
+++ b/src/it/setup-custom-toolchain/pom.xml
@@ -38,7 +38,7 @@ under the License.
org.apache.maven
maven-core
- 3.0.5
+ 3.8.1
diff --git a/src/it/skip-fail/invoker.properties b/src/it/skip-fail/invoker.properties
new file mode 100644
index 0000000..cbb67b6
--- /dev/null
+++ b/src/it/skip-fail/invoker.properties
@@ -0,0 +1,20 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+invoker.goals = compile
+# cannot run this IT with Maven 2 since required --toolchains option was added in 3.0-alpha-3: see MNG-3714
+invoker.maven.version = 3.0+
diff --git a/src/it/skip-fail/pom.xml b/src/it/skip-fail/pom.xml
new file mode 100644
index 0000000..ff701e3
--- /dev/null
+++ b/src/it/skip-fail/pom.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.plugins.toolchains.its
+ skip-fail
+ 1.0-SNAPSHOT
+ jar
+
+ maven-toolchains-plugin IT: missing toolchain test
+
+ Check that toolchain requirements are checked and not covered as expected
+
+
+
+ UTF-8
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-toolchains-plugin
+ @project.version@
+
+
+
+ toolchain
+
+
+
+
+
+
+
+ value
+ other-value
+
+
+
+ false
+
+
+
+
+
diff --git a/src/it/skip-fail/verify.groovy b/src/it/skip-fail/verify.groovy
new file mode 100644
index 0000000..e1b7fe5
--- /dev/null
+++ b/src/it/skip-fail/verify.groovy
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+content = new File( basedir, 'build.log' ).text
+
+assert content.indexOf( "MojoFailureException: Cannot find matching toolchain definitions for the following toolchain types:" ) > 0
diff --git a/src/main/java/org/apache/maven/plugins/toolchain/ToolchainMojo.java b/src/main/java/org/apache/maven/plugins/toolchain/ToolchainMojo.java
index d8454f6..90b4ef2 100644
--- a/src/main/java/org/apache/maven/plugins/toolchain/ToolchainMojo.java
+++ b/src/main/java/org/apache/maven/plugins/toolchain/ToolchainMojo.java
@@ -70,6 +70,13 @@ public class ToolchainMojo extends AbstractMojo {
@Parameter(required = true)
private ToolchainsRequirement toolchains;
+ /**
+ * Flag to fail the build if toolchain requirements not met.
+ * @since 3.0.1
+ */
+ @Parameter( defaultValue = "true" )
+ private boolean fail;
+
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
if (toolchains == null) {
@@ -99,10 +106,17 @@ public void execute() throws MojoExecutionException, MojoFailureException {
buff.append(getToolchainRequirementAsString(type, toolchains.getParams(type)));
}
- getLog().error(buff.toString());
+ if ( fail )
+ {
+ getLog().error( buff.toString() );
- throw new MojoFailureException(buff.toString() + System.lineSeparator()
- + "Please make sure you define the required toolchains in your ~/.m2/toolchains.xml file.");
+ throw new MojoFailureException( buff.toString() + System.lineSeparator()
+ + "Please make sure you define the required toolchains in your ~/.m2/toolchains.xml file." );
+ }
+ else
+ {
+ getLog().warn( buff.toString() );
+ }
}
}