[ 
https://issues.apache.org/jira/browse/MDEP-932?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Elliotte Rusty Harold updated MDEP-932:
---------------------------------------
    Description: 
In  AbstractDependencyMojo

Either a file is copied successfully and no one wants to read this message or 
it fails and an exception is thrown. Either way, the log message simply isn't 
needed and gets in the way of debugging real failures. 


/**
     * Does the actual copy of the file and logging.
     *
     * @param artifact represents the file to copy.
     * @param destFile file name of destination file.
     * @throws MojoExecutionException with a message if an error occurs.
     */
    protected void copyFile(File artifact, File destFile) throws 
MojoExecutionException {
        try {
            getLog().info("Copying "
                    + (this.outputAbsoluteArtifactFilename ? 
artifact.getAbsolutePath() : artifact.getName()) + " to "
                    + destFile);

            if (artifact.isDirectory()) {
                // usual case is a future jar packaging, but there are special 
cases: classifier and other packaging
                throw new MojoExecutionException("Artifact has not been 
packaged yet. When used on reactor artifact, "
                        + "copy should be executed after packaging: see 
MDEP-187.");
            }

            FileUtils.copyFile(artifact, destFile);
            buildContext.refresh(destFile);
        } catch (IOException e) {
            throw new MojoExecutionException("Error copying artifact from " + 
artifact + " to " + destFile, e);
        }
    }

  was:
In   AbstarctDependencyMojo

Either a is file copied successfully and no one wants to read this message or 
it fails and an exception is thrown. Either way, the log message simply isn';t 
needed and gets in the way of debugging real failures. 


/**
     * Does the actual copy of the file and logging.
     *
     * @param artifact represents the file to copy.
     * @param destFile file name of destination file.
     * @throws MojoExecutionException with a message if an error occurs.
     */
    protected void copyFile(File artifact, File destFile) throws 
MojoExecutionException {
        try {
            getLog().info("Copying "
                    + (this.outputAbsoluteArtifactFilename ? 
artifact.getAbsolutePath() : artifact.getName()) + " to "
                    + destFile);

            if (artifact.isDirectory()) {
                // usual case is a future jar packaging, but there are special 
cases: classifier and other packaging
                throw new MojoExecutionException("Artifact has not been 
packaged yet. When used on reactor artifact, "
                        + "copy should be executed after packaging: see 
MDEP-187.");
            }

            FileUtils.copyFile(artifact, destFile);
            buildContext.refresh(destFile);
        } catch (IOException e) {
            throw new MojoExecutionException("Error copying artifact from " + 
artifact + " to " + destFile, e);
        }
    }


> Don't log successful file copies
> --------------------------------
>
>                 Key: MDEP-932
>                 URL: https://issues.apache.org/jira/browse/MDEP-932
>             Project: Maven Dependency Plugin
>          Issue Type: Improvement
>            Reporter: Elliotte Rusty Harold
>            Priority: Minor
>
> In  AbstractDependencyMojo
> Either a file is copied successfully and no one wants to read this message or 
> it fails and an exception is thrown. Either way, the log message simply isn't 
> needed and gets in the way of debugging real failures. 
> /**
>      * Does the actual copy of the file and logging.
>      *
>      * @param artifact represents the file to copy.
>      * @param destFile file name of destination file.
>      * @throws MojoExecutionException with a message if an error occurs.
>      */
>     protected void copyFile(File artifact, File destFile) throws 
> MojoExecutionException {
>         try {
>             getLog().info("Copying "
>                     + (this.outputAbsoluteArtifactFilename ? 
> artifact.getAbsolutePath() : artifact.getName()) + " to "
>                     + destFile);
>             if (artifact.isDirectory()) {
>                 // usual case is a future jar packaging, but there are 
> special cases: classifier and other packaging
>                 throw new MojoExecutionException("Artifact has not been 
> packaged yet. When used on reactor artifact, "
>                         + "copy should be executed after packaging: see 
> MDEP-187.");
>             }
>             FileUtils.copyFile(artifact, destFile);
>             buildContext.refresh(destFile);
>         } catch (IOException e) {
>             throw new MojoExecutionException("Error copying artifact from " + 
> artifact + " to " + destFile, e);
>         }
>     }



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to