aboutcode-org / dependency-inspector

A general purpose, mostly universal software package dependency resolver.
Apache License 2.0
2 stars 2 forks source link

Create Maven "lockfile" using built-in from maven.... It supports a dot, graphml and tgf output format. (And soon JSON!) #6

Open pombredanne opened 5 months ago

pombredanne commented 5 months ago

Note that Maven now has a JSON format!

monperrus commented 5 months ago

https://github.com/chains-project/maven-lockfile should work well here, we can help with integration.

pombredanne commented 2 months ago

@monperrus Thanks. This would be great.

LogFlames commented 1 month ago

@pombredanne I'm starting to work on this implementation and wanted to ask about how you prefer to handle modules?

maven-lockfile behaves the same as mvn dependency:tree in regards to processing all pom.xml in the codebase (that are linked as modules) and generates one lockfile per pom file. Since the check if a lockfile already exists (and enforces the --force flag) is done in the Go code, I wonder how you prefer this be solved?

My suggestions are:

  1. We check only the main lockfile.json in the root of the project. This might accidentally overwrite lockfiles in modules without warning and without requiring the --force flag.
  2. We check for lockfiles.json in all folders of the project. This might accidentally require the --force flag even though nothing would get overwritten.
  3. Use a maven plugin to list all poms belonging to the project. This would create an accurate --force flag, not pollute the Go code, but requires another plugin be installed by the user.
  4. We parse the pom.xml in Go and check all module folders. This would make the footprint of the Go code much larger.

What do you think? Of course open to other suggestions/solutions!

LogFlames commented 1 month ago

Using the KISS principle I created a PR for option 1 to get it rolling. Happy to implement other option if preferred!

LogFlames commented 1 month ago

@pombredanne have you had time to look at this? wdyt of the options above?