diff --git a/its/core-it-suite/src/test/resources/mng-0870/plugin/src/main/java/org/apache/maven/plugin/coreit/LoadMojo.java b/its/core-it-suite/src/test/resources/mng-0870/plugin/src/main/java/org/apache/maven/plugin/coreit/LoadMojo.java
index a0191f6ea1d5..4406463cd42d 100644
--- a/its/core-it-suite/src/test/resources/mng-0870/plugin/src/main/java/org/apache/maven/plugin/coreit/LoadMojo.java
+++ b/its/core-it-suite/src/test/resources/mng-0870/plugin/src/main/java/org/apache/maven/plugin/coreit/LoadMojo.java
@@ -38,7 +38,6 @@
*/
import java.io.File;
-import java.io.IOException;
import java.net.URL;
import org.apache.maven.plugin.AbstractMojo;
@@ -81,14 +80,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (url == null) {
throw new MojoExecutionException("Resource was not found, incomplete plugin class realm");
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + file);
-
- try {
- file.getParentFile().mkdirs();
- file.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + file, e);
- }
+ createFile(file);
}
}
diff --git a/its/core-it-suite/src/test/resources/mng-1088/plugin/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java b/its/core-it-suite/src/test/resources/mng-1088/plugin/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java
index a2ebf93592c5..0a13316e202b 100644
--- a/its/core-it-suite/src/test/resources/mng-1088/plugin/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java
+++ b/its/core-it-suite/src/test/resources/mng-1088/plugin/src/main/java/org/apache/maven/plugin/coreit/TouchMojo.java
@@ -38,7 +38,6 @@
*/
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -66,13 +65,6 @@ public class TouchMojo extends AbstractMojo {
* @throws MojoExecutionException If the output file could not be created.
*/
public void execute() throws MojoExecutionException {
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + file);
-
- try {
- file.getParentFile().mkdirs();
- file.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + file, e);
- }
+ createFile(file);
}
}
diff --git a/its/core-it-support/core-it-component/pom.xml b/its/core-it-support/core-it-component/pom.xml
index fb44f9dbb2f9..c70121eb95db 100644
--- a/its/core-it-support/core-it-component/pom.xml
+++ b/its/core-it-support/core-it-component/pom.xml
@@ -29,4 +29,10 @@ under the License.
core-it-component
Maven IT Component
+
+
+ org.apache.maven
+ maven-plugin-api
+
+
diff --git a/its/core-it-support/core-it-component/src/main/java/org/apache/maven/coreit/component/MojoCompanion.java b/its/core-it-support/core-it-component/src/main/java/org/apache/maven/coreit/component/MojoCompanion.java
new file mode 100644
index 000000000000..6740b161dbeb
--- /dev/null
+++ b/its/core-it-support/core-it-component/src/main/java/org/apache/maven/coreit/component/MojoCompanion.java
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+package org.apache.maven.coreit.component;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.MojoExecutionException;
+
+public interface MojoCompanion {
+
+ static void createFile(File file) throws MojoExecutionException {
+ if (file.getParentFile().mkdirs()) {
+ try {
+ file.createNewFile();
+ } catch (IOException e) {
+ throw new MojoExecutionException(e);
+ }
+ }
+ }
+}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-clean-plugin/src/main/java/org/apache/maven/plugin/coreit/CleanMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-clean-plugin/src/main/java/org/apache/maven/plugin/coreit/CleanMojo.java
index ec70b87b2ea1..cfbbe7162896 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-clean-plugin/src/main/java/org/apache/maven/plugin/coreit/CleanMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-clean-plugin/src/main/java/org/apache/maven/plugin/coreit/CleanMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java
index 17dbb9b77bda..07839fe3ceb1 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/CompileMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/TestCompileMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/TestCompileMojo.java
index dd3d216cae26..8edcc944110e 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/TestCompileMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/coreit/TestCompileMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java
index a76b27f4cda9..43f61413de9a 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-deploy-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/EarMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/EarMojo.java
index 56629d493389..26157739cd93 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/EarMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/EarMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/GenerateApplicationXmlMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/GenerateApplicationXmlMojo.java
index 3ce9072a63bf..ae817455640c 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/GenerateApplicationXmlMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ear-plugin/src/main/java/org/apache/maven/plugin/coreit/GenerateApplicationXmlMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/coreit/EjbMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/coreit/EjbMojo.java
index 9a98643afec5..863b63698dab 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/coreit/EjbMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-ejb-plugin/src/main/java/org/apache/maven/plugin/coreit/EjbMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-install-plugin/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-install-plugin/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java
index 75a78a21b041..c6d0aeb5bee2 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-install-plugin/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-install-plugin/src/main/java/org/apache/maven/plugin/coreit/InstallMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-jar-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-jar-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java
index 3c456da35f36..7011ca6a96d1 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-jar-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-jar-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java
index 948dbc8fbb21..adb79561cdf9 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/DescriptorMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/DescriptorMojo.java
index a851911f20ae..b237ac03532c 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/DescriptorMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/coreit/DescriptorMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-rar-plugin/src/main/java/org/apache/maven/plugin/coreit/RarMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-rar-plugin/src/main/java/org/apache/maven/plugin/coreit/RarMojo.java
index 14777f405e9b..c38372d0426e 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-rar-plugin/src/main/java/org/apache/maven/plugin/coreit/RarMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-rar-plugin/src/main/java/org/apache/maven/plugin/coreit/RarMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/TestResourcesMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/TestResourcesMojo.java
index af1f7be7fe6e..48e444ebc0c0 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/TestResourcesMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-resources-plugin/src/main/java/org/apache/maven/plugin/coreit/TestResourcesMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/AttachDescriptorMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/AttachDescriptorMojo.java
index ac097c685cfd..3bef7b279fb2 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/AttachDescriptorMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/AttachDescriptorMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java
index 6570d573e296..ce08501e9e7c 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/DeployMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/SiteMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/SiteMojo.java
index da0450f0c4a5..2394312acde4 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/SiteMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-site-plugin/src/main/java/org/apache/maven/plugin/coreit/SiteMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java
index 926bb0004604..149e3ba8b53f 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-source-plugin/src/main/java/org/apache/maven/plugin/coreit/JarMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java
index 615041e6dcea..4597c4406faa 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/coreit/TestMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-war-plugin/src/main/java/org/apache/maven/plugin/coreit/WarMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-war-plugin/src/main/java/org/apache/maven/plugin/coreit/WarMojo.java
index 847510188edb..2df7cd3150a1 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-war-plugin/src/main/java/org/apache/maven/plugin/coreit/WarMojo.java
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/maven-war-plugin/src/main/java/org/apache/maven/plugin/coreit/WarMojo.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.coreit;
import java.io.File;
-import java.io.IOException;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
@@ -29,6 +28,8 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
+import static org.apache.maven.coreit.component.MojoCompanion.createFile;
+
/**
* Creates a text file in the project base directory.
*
@@ -69,16 +70,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
if (!outputFile.isAbsolute()) {
outputFile = new File(project.getBasedir(), pathname).getAbsoluteFile();
}
-
- getLog().info("[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile);
-
- try {
- outputFile.getParentFile().mkdirs();
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new MojoExecutionException("Output file could not be created: " + pathname, e);
- }
-
- getLog().info("[MAVEN-CORE-IT-LOG] Created output file: " + outputFile);
+ createFile(outputFile);
}
}
diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/pom.xml
index 088aed014f4a..969871e80eec 100644
--- a/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/pom.xml
+++ b/its/core-it-support/core-it-plugins/maven-it-plugin-core-stubs/pom.xml
@@ -50,6 +50,12 @@ under the License.
maven-surefire-plugin
maven-war-plugin
+
+
+ org.apache.maven.its
+ core-it-component
+
+
diff --git a/its/core-it-support/pom.xml b/its/core-it-support/pom.xml
index 8f536ad61e27..c9ca2dfd4322 100644
--- a/its/core-it-support/pom.xml
+++ b/its/core-it-support/pom.xml
@@ -51,6 +51,11 @@ under the License.
maven-plugin-annotations
3.15.1
+
+ org.apache.maven.its
+ core-it-component
+ 2.1-SNAPSHOT
+