You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Charles Honton (Jira)" <ji...@apache.org> on 2022/02/14 21:07:00 UTC
[jira] [Created] (MDEP-790) New Goals: analyze-main and analyze-test
Charles Honton created MDEP-790:
-----------------------------------
Summary: New Goals: analyze-main and analyze-test
Key: MDEP-790
URL: https://issues.apache.org/jira/browse/MDEP-790
Project: Maven Dependency Plugin
Issue Type: New Feature
Reporter: Charles Honton
As a user of the dependency plugin, I desire two new goals; analyze-main and analysis-test. Each goal is similar to the analyze-only goal.
The following parameters are supported:
|<ignoredUnusedDeclaredDependencies>|String[]|List of dependencies that will be ignored if they are declared but unused. The filter syntax is:
[groupId]:[artifactId]:[type]:[version]
where each pattern segment is optional and supports full and partial * wildcards. An empty pattern segment is treated as an implicit wildcard. *
For example, org.apache. \{*}will match all artifacts whose group id starts with org.apache., and :::{*}-SNAPSHOT will match all snapshot artifacts.|
|<ignoredUsedUndeclaredDependencies>|String[]|List of dependencies that will be ignored if they are used but undeclared. The filter syntax is:
[groupId]:[artifactId]:[type]:[version]
where each pattern segment is optional and supports full and partial * wildcards. An empty pattern segment is treated as an implicit wildcard. *
For example, org.apache. \{*}will match all artifacts whose group id starts with org.apache., and :::{*}-SNAPSHOT will match all snapshot artifacts.|
|<skip>|boolean|Skip plugin execution completely.
{*}Default value is{*}: false.
{*}User property is{*}: mdep.analyze.skip.|
|<skipMainAnalyze>|boolean|Skip analyze-main goal execution.
{*}Default value is{*}: false.
{*}User property is{*}: mdep.analyze.skipMain.|
|<skipTestAnalyze>|boolean|Skip analyze-test goal execution.
{*}Default value is{*}: false.
{*}User property is{*}: mdep.analyze.skipTest.|
|<usedDependencies>|String[]|Force dependencies as used, to override incomplete result caused by bytecode-level analysis. Dependency format is groupId:artifactId.|
The analyze-main goal will
* Require a Maven project to be executed.
* Require dependency resolution of artifacts in scope: compile.
* Bind by default to the lifecycle phase: process-classes.
The algorithm it implements is as follows:
# Use byte code inspection on each class in the main artifact to determine the set of classes required to compile the main sources. These classes are the used-classes set. If there is not a main artifact, the used-classes set is empty.
# Determine in which dependencies each used class is present. Add these dependencies to the used-dependency set.
# If any used class is present in multiple used-dependency dependencies, add that class and list of dependencies to the multiple-definition map.
# Add any dependency declared in the _usedDependencies_ parameter to the used-dependency set.
# The declared-dependency set contains the main-artifact and the compile-scope dependency set from the maven resolver.
# Add each dependency in the declared-dependency set that is not in the used-dependency set to the declared-but-unused list.
# Remove any dependency from the declared-but-unused set that matches patterns declared in the _ignoreUnusedDeclaredDependencies_ parameter.
# The classpath-dependency set contains the main-artifact and the compile-scope, provided-scope, and system-scope dependency sets from the maven resolver.
# Add each dependency in the used-dependency set that is not in the classpath-dependency set to the used-but-undeclared set
# Remove any dependency from the used-but-undeclared set that matches patterns declared in the _ignoreUsedUndeclaredDependencies_ parameter.
# If the multiple-definition map is non-empty, print as warning the class name and artifacts the class is defined in.
# Print remaining members of declared-but-unused set to the console
# Print remaining members of used-but-undeclared set to the console
# If either declared-but-unused set or used-but-undeclared set is not empty, fail the build
The analyze-test goal will
* Require a Maven project to be executed.
* Require dependency resolution of artifacts in scope: test-compile.
* Bind by default to the lifecycle phase: process-test-classes.
The algorithm it implements is the same as analyze-main algorithm with the following modifications:
1. Use the test artifact instead of the main artifact to determine the used-classes set.
5. The declared-dependency set contains the main-artifact, the test-artifact, and the test-scope dependency set from the maven resolver.
8. The classpath-dependency set contains the main-artifact, the test-artifact, and the test-scope, compile-scope, provided-scope, and system-scope dependency sets from the maven resolver
--
This message was sent by Atlassian Jira
(v8.20.1#820001)