Add dependency resources reference that includes resolved artifact files (#373) - #379
Add dependency resources reference that includes resolved artifact files (#373)#379elharo wants to merge 4 commits into
Conversation
|
This change breaks existing projects that rely on the aggregate dependencies reference.
The architectural purpose of this change is to alter how the dependency paths are resolved. By assembling the |
|
It is not possible to achieve this specific fix while maintaining a single Ant An Ant However, backward compatibility for users relying on the 1. Dual References (Deprecation Approach)The plugin can maintain the existing A new reference (e.g., 2. Staging Directory (File I/O Approach)The plugin can resolve all dependencies (both reactor and local repository), and copy or hardlink them into a temporary staging directory within the build's The plugin can then return a standard |
|
Only the first approach preserves existing behavior for existing pom.xml files. Let's do that. |
Fixes #373
Summary
The aggregate
maven.project.dependenciesreference was aFileSetrooted at the local repository, usinglocalRepository.pathOf(artifact)for its include patterns. Artifacts that are not physically in the local repository (notably reactor inter-module dependencies, resolved to a sibling module's output) silently matched nothing, so the aggregate was incomplete in reactor builds.Approach
This PR keeps the legacy behavior intact and adds a new reference:
maven.project.dependenciesremains the legacyFileSetrooted at the local repository. Existing builds keep working unchanged.maven.project.dependencies.resourcesreference is added: a resource collection (Union) of per-artifactFileSets, each rooted at the actual resolved artifact file (artifact.getFile()). This includes artifacts from any location, including reactor inter-module dependencies.Changes
DependencyFilesetsTask.java: keep the local-repository-basedFileSet(including the empty-artifacts special case) and add theUnionof per-artifactFileSets fromartifact.getFile(), registered undermaven.project.dependencies.resources.antrun.mdo: newprojectDependenciesResourcesIdconfiguration attribute (defaultmaven.project.dependencies.resources).DependencyFilesetsTaskAggregateTest: the legacy fileset reference remains rooted at the local repository, and the resources reference includes artifacts outside the local repository.dependency-filesets-resources-testand updateddependencyFilesets.apt.vmdocs to cover the new resources reference. The existingfilesets-testIT is unchanged.Verification
maven.project.dependencies.resourcesreference) and passes with the fix; the legacy-reference test passes both before and after.mvn verify(rat, checkstyle, spotless, unit tests, javadoc) passes.mvn verify -Prun-itspasses: all 30 integration tests succeed, including the newdependency-filesets-resources-test; the unchangedfilesets-testIT still passes.