You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2022/09/16 09:32:49 UTC

[maven-dependency-plugin] branch MDEP-826 updated: Do not override outputDirectory

This is an automated email from the ASF dual-hosted git repository.

michaelo pushed a commit to branch MDEP-826
in repository https://gitbox.apache.org/repos/asf/maven-dependency-plugin.git


The following commit(s) were added to refs/heads/MDEP-826 by this push:
     new 8c640cf2 Do not override outputDirectory
8c640cf2 is described below

commit 8c640cf25ab9f404bdd81de6013314f978c118e9
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Fri Sep 16 11:32:20 2022 +0200

    Do not override outputDirectory
    
    A reporting plugin shall generate reports always in the reporting output
    dir. Inherit from parent and don't set manually otherwise you end up in
    issues like this:
    Only in it/analyze-testDependencyWithNonTestScope/target: css
    Only in it/analyze-testDependencyWithNonTestScope/target:
    dependency-analysis.html
    Only in it/analyze-testDependencyWithNonTestScope/target: images
    
    which is non-sense since this is clearly site content even if rendered
    in standalone mode.
    
    The output dir will be created by the caller/system.
---
 .../dependency/analyze/AnalyzeReportMojo.java      | 30 ++--------------------
 1 file changed, 2 insertions(+), 28 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReportMojo.java b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReportMojo.java
index b6f522f8..fd51491f 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReportMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/analyze/AnalyzeReportMojo.java
@@ -32,7 +32,6 @@ import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis;
 import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer;
 import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException;
 
-import java.io.File;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
@@ -55,17 +54,9 @@ public class AnalyzeReportMojo
     @Component
     private ProjectDependencyAnalyzer analyzer;
 
-    /**
-     * Target folder
-     *
-     * @since 2.0-alpha-5
-     */
-    @Parameter( defaultValue = "${project.build.directory}", readonly = true )
-    private File outputDirectory;
-
     /**
      * Ignore Runtime/Provided/Test/System scopes for unused dependency analysis
-     * 
+     *
      * @since 2.2
      */
     @Parameter( property = "ignoreNonCompile", defaultValue = "false" )
@@ -74,7 +65,7 @@ public class AnalyzeReportMojo
     /**
      * Force dependencies as used, to override incomplete result caused by bytecode-level analysis. Dependency format is
      * <code>groupId:artifactId</code>.
-     * 
+     *
      * @since 2.6
      */
     @Parameter
@@ -97,12 +88,6 @@ public class AnalyzeReportMojo
     public void executeReport( Locale locale )
         throws MavenReportException
     {
-        if ( outputDirectory == null || !outputDirectory.exists() )
-        {
-            getLog().info( "Skipping project with no Target directory" );
-            return;
-        }
-
         // Step 1: Analyze the project
         ProjectDependencyAnalysis analysis;
         try
@@ -183,17 +168,6 @@ public class AnalyzeReportMojo
         return getBundle( locale ).getString( "analyze.report.description" );
     }
 
-    /*
-     * @see org.apache.maven.reporting.AbstractMavenReport#getOutputDirectory()
-     */
-    @Override
-    protected String getOutputDirectory()
-    {
-        getLog().info( outputDirectory.toString() );
-
-        return outputDirectory.toString();
-    }
-
     // protected methods ------------------------------------------------------
 
     /**