Package org.apache.maven.api.services
Interface DependencyResolverResult
The result of a dependency resolution request.
- Since:
- 4.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionReturns all dependencies associated to their paths.Returns the file paths of all dependencies, dispatched according the tool options where to place them.Gets the exceptions that occurred while building the dependency graph.getModuleDescriptor
(Path dependency) Returns the Java module descriptor of the dependency at the given path.getModuleName
(Path dependency) Returns the Java module name of the dependency at the given path.getNodes()
The ordered list of the flattened dependency nodes.getPaths()
Returns the file paths of all dependencies, regardless on which tool option those paths should be placed.getRoot()
Gets the root node of the dependency graph.If the module-path contains at least one filename-based auto-module, prepares a warning message.
-
Method Details
-
getExceptions
Gets the exceptions that occurred while building the dependency graph.- Returns:
- the exceptions that occurred, never
null
-
getRoot
Gets the root node of the dependency graph.- Returns:
- the root node of the dependency graph or
null
if none
-
getNodes
The ordered list of the flattened dependency nodes.- Returns:
- the ordered list of the flattened dependency nodes
-
getPaths
Returns the file paths of all dependencies, regardless on which tool option those paths should be placed. The returned list may contain a mix of Java class-path, Java module-path, and other types of path elements. This collection has the same content thangetDependencies.values()
except that it does not contain null elements.- Returns:
- the paths of all dependencies
-
getDispatchedPaths
Returns the file paths of all dependencies, dispatched according the tool options where to place them. ThePathType
keys identify, for example,--class-path
or--module-path
options. In the case of Java tools, the map may also contain--patch-module
options, which are handled in a special way.Design note
All types of path are determined together because they are sometime mutually exclusive. For example, an artifact of type "jar" can be placed either on the class-path or on the module-path. The project needs to make a choice (possibly using heuristic rules), then to add the dependency in only one of the options identified byPathType
.- Returns:
- file paths to place on the different tool options
-
getDependencies
Returns all dependencies associated to their paths. Some dependencies may be associated to a null value if there is no path available.- Returns:
- all dependencies associated to their paths
-
getModuleName
Returns the Java module name of the dependency at the given path. The given dependency should be one of the paths returned bygetDependencies()
. The module name is extracted from themodule-info.class
file if present, otherwise from the"Automatic-Module-Name"
attribute of theMETA-INF/MANIFEST.MF
file if present.A typical usage is to invoke this method for all dependencies having a
TEST
orTEST_ONLY
scope. An--add-reads
option may need to be generated for compiling and running the test classes that use such dependencies.- Parameters:
dependency
- path to the dependency for which to get the module name- Returns:
- module name of the dependency at the given path, or empty if the dependency is not modular
- Throws:
IOException
- if the module information of the specified dependency cannot be read
-
getModuleDescriptor
Returns the Java module descriptor of the dependency at the given path. The given dependency should be one of the paths returned bygetDependencies()
. The module descriptor is extracted from themodule-info.class
file if present.getModuleName(Path)
is preferred when only the module name is desired, because a name may be present even if the descriptor is absent. This method is for cases when more information is desired, such as the set of exported packages.- Parameters:
dependency
- path to the dependency for which to get the module name- Returns:
- module name of the dependency at the given path, or empty if the dependency is not modular
- Throws:
IOException
- if the module information of the specified dependency cannot be read
-
warningForFilenameBasedAutomodules
If the module-path contains at least one filename-based auto-module, prepares a warning message. The module path is the collection of dependencies associated toJavaPathType.MODULES
. It is caller's responsibility to send the message to a logger.- Returns:
- warning message if at least one filename-based auto-module was found
-