microstream icon indicating copy to clipboard operation
microstream copied to clipboard

Clean up dependencies

Open rfichtner opened this issue 2 years ago • 2 comments

Describe the bug

There are some declared and some undeclared dependencies in the project.

To Reproduce

run mvn org.apache.maven.plugins:maven-dependency-plugin:3.3.0:analyze to get a list of dependency problems for each module.

Expected behavior

mvn org.apache.maven.plugins:maven-dependency-plugin:3.3.0:analyze should output no problems.

rfichtner avatar Aug 19 '22 14:08 rfichtner

@rfichtner Here I'm not sure if it is correct to list all versions in the dependency for transitive dependencies.

Example: for module:

[INFO] ------------< one.microstream:microstream-storage-embedded >------------
[INFO] Building MicroStream Embedded Storage 08.00.00-MS-GA-SNAPSHOT    [14/57]
[INFO] --------------------------------[ jar ]---------------------------------
 ...
 [INFO] --- maven-dependency-plugin:3.3.0:analyze (default-cli) @ microstream-storage-embedded ---
[WARNING] Used undeclared dependencies found:
[WARNING]    one.microstream:microstream-afs-nio:jar:08.00.00-MS-GA-SNAPSHOT:compile
[WARNING]    org.slf4j:slf4j-api:jar:1.7.32:compile
[WARNING]    one.microstream:microstream-persistence:jar:08.00.00-MS-GA-SNAPSHOT:compile
[WARNING]    one.microstream:microstream-persistence-binary:jar:08.00.00-MS-GA-SNAPSHOT:compile
[WARNING]    one.microstream:microstream-base:jar:08.00.00-MS-GA-SNAPSHOT:compile
[WARNING]    one.microstream:microstream-afs:jar:08.00.00-MS-GA-SNAPSHOT:compile

These are all modules that are transitive over a single ancestor. This project has a clear tree-like structure, has parent pom poms and the same versions.

Is it some good practice to add even transtive dependencies to the own product in pom.xml for each module? I haven't come across this in practice yet. Only in case of third libraries conflicts.

zdenek-jonas avatar Aug 22 '22 04:08 zdenek-jonas

If your code imports from a module, that module is no longer only transitive. It should be a declared dependency in Maven, so that you communicate your intent to other developers, that directly depending on that module was no mistake, but intentional.

bugabinga avatar Sep 28 '22 14:09 bugabinga