"Using the Maven 2 dependency tree to get verbose output that might not be compatible with the actual resolution of Maven 3"

I changed the version of maven-dependency-plugin from 2.8 to 2.10. Now when I run mvn dependency:tree -Dverbose , I see the following warning:

 [WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution 

The version of Maven I'm using is

 Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00) 
  • Can I fix it or avoid it at all?
  • Was it always that Maven 2 was used to output -Dverbose , but only now did they add a warning?
+6
source share
1 answer

An explanation of your problem can be found in the official documentation:

verbose Whether to include the omitted nodes in the serialized dependency tree. Please note that this function actually uses the Maven 2 algorithm and may give incorrect results when used with Maven 3.

Look at line 245 of TreeMojo.java for version 2.10:

 if ( verbose ) { // verbose mode force Maven 2 dependency tree component use if ( ! isMaven2x() ) { getLog().warn( "Using Maven 2 dependency tree to get verbose output, " + "which may be inconsistent with actual Maven 3 resolution" ); } dependencyTreeString = serializeVerboseDependencyTree( dependencyTreeBuilder.buildDependencyTree( project, localRepository, artifactFilter ) ); } 

It actually prints a warning if maven 2 is not used.

Now look at line 243 of TreeMojo.java for version 2.8:

 if ( verbose ) { // verbose mode force Maven 2 dependency tree component use dependencyTreeString = serializeVerboseDependencyTree( dependencyTreeBuilder.buildDependencyTree( project, localRepository, artifactFilter ) ); } 

Warning logs do not exist there, therefore:

Was it always that Maven 2 was used for -Dverbose, but only now they added a warning?

Yes, a warning has been added since version 2.8.

Can I fix this or avoid it at all?

I do not think this does not ignore warning log messages or editing source code.

However, as you can see, the functionality of Maven 2 was already used in 2.8. I hope you get rid of it in later versions when they migrate dependency:tree -Dverbose to use maven 3 functionality.

+8
source

Source: https://habr.com/ru/post/984611/


All Articles