Issue #492 restore compile-only reactor module so downstream resoluti…#493
Open
yeroc wants to merge 1 commit into
Open
Issue #492 restore compile-only reactor module so downstream resoluti…#493yeroc wants to merge 1 commit into
yeroc wants to merge 1 commit into
Conversation
…solution works When a cached build did not reach the package phase the cache entry's primary artifact is the target/classes directory rather than a jar. restoreProjectArtifacts only set project.getArtifact() to the restored artifact when the cached file was a regular jar, leaving directory artifacts unbound. In a multi-module reactor that meant downstream modules could not find the upstream's classes on the second `mvn clean compile` invocation and fell through to remote repositories with "Could not find artifact ...:jar:...-SNAPSHOT". For directory artifacts, set the file on the existing project artifact instead of replacing it with RestoredArtifact. RestoredArtifact.getFile always re-routes through its restoreToDiskConsumer, which would later break package-phase plugins (e.g. jar:jar) that update the artifact's file via setFile. Adds CompileOnlyReactorRestoreTest covering this case.
Author
|
I considered renaming the existing |
Author
|
@sparsick looking at the failure for build # 2 it looked like a strange intermittent issue pulling down transitive dependencies from Maven Central. The 3rd build was cancelled. As far as I can tell the failure doesn't appear to be related to the changes I made? Thoughts? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #492
Description
restoreProjectArtifactsonly wires upproject.getArtifact()to a restored artifact when the cached file is a regular jar. For compile-only cached builds the primary cached artifact is thetarget/classesdirectory, which falls through that condition unset. In a multi-module reactor that leaves downstream modules unable to resolve the upstream as a reactor artifact on a subsequentmvn clean compile, and they fall through to remote repositories withCould not find artifact ...:jar:...-SNAPSHOT.For the directory case this PR sets the file on the existing project artifact instead of replacing it with a
RestoredArtifact.RestoredArtifact.getFileroutes throughrestoreToDiskConsumeron every call, which would later break package-phase plugins (e.g.jar:jar) that update the file viasetFile.Added
CompileOnlyReactorRestoreTest, which reuses the existingissue-393-compile-restorereactor project to exercise two consecutive compile-only invocations. The test fails on master and passes with this change.Checklist
mvn verifyto make sure basic checks pass.mvn -Prun-its verify).