Skip to content

feat: Java dependency graph information#3363

Merged
kzantow merged 5 commits intoanchore:mainfrom
kzantow-anchore:feat/java-dependency-graph
Oct 23, 2024
Merged

feat: Java dependency graph information#3363
kzantow merged 5 commits intoanchore:mainfrom
kzantow-anchore:feat/java-dependency-graph

Conversation

@kzantow
Copy link
Copy Markdown
Contributor

@kzantow kzantow commented Oct 21, 2024

Description

This PR implements dependency graph information for Java packages. This applies primarily to these scenarios:

  • source scan of Java Maven-based projects, which now includes appropriate top-level and optionally, transitive dependency information
  • nested archive with embedded packages

For example: a user scanning a .war file with multiple embedded .jar files, the topmost package representing the .war file will have dependency relationships from the specific packages surfaced from the included .jar files.

Additionally, this PR includes a refactoring the internal Maven resolver functionality to an internal package to provide clearer boundaries of usage vs. internal methods.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have added unit tests that cover changed behavior
  • I have tested my code in common scenarios and confirmed there are no regressions
  • I have added comments to my code, particularly in hard-to-understand sections

Signed-off-by: Keith Zantow <kzantow@gmail.com>
@kzantow kzantow force-pushed the feat/java-dependency-graph branch from 416abdd to 0bb3031 Compare October 21, 2024 20:06
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
PomProperties: &pkg.JavaPomProperties{
GroupID: id.GroupID,
ArtifactID: id.ArtifactID,
Scope: r.ResolveProperty(ctx, pom, dep.Scope),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PomProperties has the scope? This doesn't seem right, but this was the existing behavior.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed -- we should make a syft 2.0 for this and mark the field as deprecated. There is a discussion in #572 on how to mark dev/test deps on edges, but for now we've elected to not track these.

Copy link
Copy Markdown
Contributor

@wagoodman wagoodman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Signed-off-by: Keith Zantow <kzantow@gmail.com>
@kzantow kzantow merged commit a00533c into anchore:main Oct 23, 2024
@kzantow kzantow deleted the feat/java-dependency-graph branch October 23, 2024 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Emit relationships for Java dependencies

2 participants