Skip to content

Code changes for plugin dependencies include test scope#1487

Open
akallian-eng wants to merge 3 commits intochains-project:mainfrom
akallian-eng:STONEBLD-4200-include-test-scope
Open

Code changes for plugin dependencies include test scope#1487
akallian-eng wants to merge 3 commits intochains-project:mainfrom
akallian-eng:STONEBLD-4200-include-test-scope

Conversation

@akallian-eng
Copy link

No description provided.

Copy link
Contributor

@adambkaplan adambkaplan left a comment

Choose a reason for hiding this comment

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

Added my comments - it looks like there are other formatting issues that need to be checked by running mvn spotless:apply.

I'm a bit concerned that this is a "band-aid" that papers over a deeper bug. After all, we don't see standard compile-scoped dependencies bring in their test-scoped dependencies. Is the mechanism for building the dependency tree for plugins too broad in the first place?

MetaData metadata) {
PluginLogManager.getLog().info(String.format("Generating lock file for project %s", project.getArtifactId()));
Set<MavenPlugin> plugins = new TreeSet<>();
Set<MavenPlugin> plugins = new TreeSet<>(Comparator.comparing(MavenPlugin::getChecksum));
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change required/necessary?

DependencyCollectorBuilder dependencyCollectorBuilder,
AbstractChecksumCalculator checksumCalculator) {
Set<MavenPlugin> plugins = new TreeSet<>();
Set<MavenPlugin> plugins = new TreeSet<>(Comparator.comparing(MavenPlugin::getChecksum));
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto - is this required/necessary?

String relativePath = project.getFile() == null
? null
: initialProject
.getBasedir()
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary formatting change, please revert.

AbstractChecksumCalculator calc,
boolean isRoot,
boolean reduce) {
boolean reduce,boolean skipTestScope) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: format

Suggested change
boolean reduce,boolean skipTestScope) {
boolean reduce,
boolean skipTestScope) {

Comment on lines 93 to 97
if (skipPluginTestDependency(node, isRoot, skipTestScope)) {
PluginLogManager.getLog().debug(
"Skipping plugin test-scope dependency: " + node.toNodeString());
return Optional.empty();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we simplify this and avoid a separate function call?

(pseudocode below)

if (skipTestScope && !isRoot && MavenScope.Test.equals(scope)) {
   ...
}


DependencyGraph dependencyGraph = DependencyGraph.of(graph, checksumCalculator, false);

DependencyGraph dependencyGraph = DependencyGraph.of(graph, checksumCalculator,false, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Worth adding a comment here that we are excluding test scope.

Suggested change
DependencyGraph dependencyGraph = DependencyGraph.of(graph, checksumCalculator,false, true);
// Ignore test scoped dependencies for plugins.
DependencyGraph dependencyGraph = DependencyGraph.of(graph, checksumCalculator,false, true);

@akallian-eng
Copy link
Author

akallian-eng commented Feb 3, 2026 via email

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.

2 participants