-
Notifications
You must be signed in to change notification settings - Fork 182
Improve usage of silent parameter in Copy and Unpack goals #1517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,19 +55,26 @@ public CopyUtil(BuildContext buildContext) { | |
* | ||
* @param sourceArtifact the artifact (file) to copy | ||
* @param destination file name of destination file | ||
* @param silent if true, don't show information about copied files | ||
* @throws IOException if copy has failed | ||
* @throws MojoExecutionException if artifact file is a directory (which has not been packaged yet) | ||
* @since 3.7.0 | ||
*/ | ||
public void copyArtifactFile(Artifact sourceArtifact, File destination) throws IOException, MojoExecutionException { | ||
public void copyArtifactFile(Artifact sourceArtifact, File destination, boolean silent) | ||
throws IOException, MojoExecutionException { | ||
File source = sourceArtifact.getFile(); | ||
if (source.isDirectory()) { | ||
// usual case is a future jar packaging, but there are special cases: classifier and other packaging | ||
throw new MojoExecutionException("Artifact '" + sourceArtifact | ||
+ "' has not been packaged yet (is a directory). When used on reactor artifact, " | ||
+ "copy should be executed after packaging: see MDEP-187."); | ||
} | ||
logger.debug("Copying artifact '{}' ({}) to {}", sourceArtifact.getId(), sourceArtifact.getFile(), destination); | ||
|
||
if (!silent || logger.isDebugEnabled()) { | ||
logger.info( | ||
"Copying artifact '{}' ({}) to {}", sourceArtifact.getId(), sourceArtifact.getFile(), destination); | ||
} | ||
|
||
FileUtils.copyFile(source, destination); | ||
buildContext.refresh(destination); | ||
} | ||
|
@@ -77,11 +84,14 @@ public void copyArtifactFile(Artifact sourceArtifact, File destination) throws I | |
* | ||
* @param source the source file to copy | ||
* @param destination the destination file | ||
* @param silent if true, don't show information about copied files | ||
* @throws IOException if copy has failed | ||
* @since 3.2.0 | ||
*/ | ||
public void copyFile(File source, File destination) throws IOException { | ||
logger.debug("Copying file '{}' to {}", source, destination); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really can't see why this should be anything other than debug by default. This is not an actionable message. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. eg. When using |
||
public void copyFile(File source, File destination, boolean silent) throws IOException { | ||
if (!silent || logger.isDebugEnabled()) { | ||
logger.info("Copying file '{}' to {}", source, destination); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and now if the user turns on debugging but this is silent they don't see this |
||
} | ||
FileUtils.copyFile(source, destination); | ||
buildContext.refresh(destination); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should still be deprecated as it was where it was moved from