Skip to content

Commit

Permalink
New copy-file goal - javadoc
Browse files Browse the repository at this point in the history
Update javadoc for the copy-file goal
  • Loading branch information
OndroMih committed Jun 20, 2024
1 parent 1e82f9f commit 1dbe3f1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/org/glassfish/build/CopyFileMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.apache.maven.project.MavenProject;

/**
* Echo a message.
* Copy a file or the main artifact to a location.
*/
@Mojo(name = "copy-file", threadSafe = true)
public final class CopyFileMojo extends AbstractMojo {
Expand All @@ -43,12 +43,21 @@ public final class CopyFileMojo extends AbstractMojo {
@Parameter(property = PROPERTY_PREFIX + "sourceFile")
private File sourceFile;

/**
* Destination location of the copied file. Required, unless {@code skip=true}.
*/
@Parameter(property = PROPERTY_PREFIX + "destFile")
private File destFile;

/**
* If {@code true}, overwrite a file if it exists in the destFile location. Otherwise give an error.
*/
@Parameter(property = PROPERTY_PREFIX + "overwrite", defaultValue = "true")
private boolean overwrite;

/**
* Skip goal execution.
*/
@Parameter(property = PROPERTY_PREFIX + "skip", defaultValue = "false")
private boolean skip;

Expand All @@ -71,7 +80,7 @@ public void execute() throws MojoExecutionException {
}
try {
Files.createDirectories(destFile.getParentFile().toPath());
getLog().info("Copying " + sourceFile + " to " + destFile);
getLog().info("Copying " + sourceFile.getCanonicalPath() + " to " + destFile.getCanonicalPath());
if (overwrite) {
Files.copy(sourceFile.toPath(), destFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
} else {
Expand Down

0 comments on commit 1dbe3f1

Please sign in to comment.