Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
*/

import java.io.File;
import java.io.IOException;
import java.net.URL;

import org.apache.maven.plugin.AbstractMojo;
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
*/

import java.io.File;
import java.io.IOException;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
Expand Down Expand Up @@ -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);
}
}
6 changes: 6 additions & 0 deletions its/core-it-support/core-it-component/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,10 @@ under the License.
<artifactId>core-it-component</artifactId>

<name>Maven IT Component</name>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
*
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
*
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
*
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
*
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
*
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
*
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
*
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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.
*
Expand Down Expand Up @@ -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);
}
}
Loading