Skip to content

[MNG-7629] Change reactor reader to copy packaged artifacts and reuse them across builds if needed#954

Merged
gnodet merged 19 commits intoapache:masterfrom
gnodet:MNG-7629-alternative
Jan 19, 2023
Merged

[MNG-7629] Change reactor reader to copy packaged artifacts and reuse them across builds if needed#954
gnodet merged 19 commits intoapache:masterfrom
gnodet:MNG-7629-alternative

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented Jan 12, 2023

Similar to #912 but without removing the best effort artifact resolution to keep mvn test working if possible.

This require a few ITs to be modified:
apache/maven-integration-testing#234

@gnodet gnodet force-pushed the MNG-7629-alternative branch from 178a46e to 7421d07 Compare January 12, 2023 09:24
@gnodet gnodet force-pushed the MNG-7629-alternative branch 2 times, most recently from d7931d9 to 489e194 Compare January 13, 2023 16:19
@gnodet gnodet force-pushed the MNG-7629-alternative branch from 489e194 to 9a5ac83 Compare January 13, 2023 16:20
Copy link
Copy Markdown
Contributor

@mthmulders mthmulders left a comment

Choose a reason for hiding this comment

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

Left a couple of questions.

Also, I wonder if this change allows us to remove the fallbacks that were previously on line 150 - 159. Since those lines aren't changed, it seems GitHub doesn't allow me to comment on the spot :-\.

Comment thread maven-core/src/main/java/org/apache/maven/ReactorReader.java Outdated
Comment thread maven-core/src/main/java/org/apache/maven/ReactorReader.java
Comment thread maven-core/src/main/java/org/apache/maven/ReactorReader.java Outdated
Comment thread maven-core/src/main/java/org/apache/maven/ReactorReader.java Outdated
Comment thread maven-core/src/main/java/org/apache/maven/ReactorReader.java Outdated
Comment thread maven-core/src/main/java/org/apache/maven/ReactorReader.java Outdated
Comment thread maven-core/src/main/java/org/apache/maven/ReactorReader.java Outdated
@gnodet
Copy link
Copy Markdown
Contributor Author

gnodet commented Jan 17, 2023

Left a couple of questions.

Also, I wonder if this change allows us to remove the fallbacks that were previously on line 150 - 159. Since those lines aren't changed, it seems GitHub doesn't allow me to comment on the spot :-.

Good question. I think part of it could be removed, but we need to keep the determineBuildOutputDirectoryForArtifact in order to be able to partially run mvn test.

Another possible strategy instead of copying the artifacts would be to only record their paths.

@gnodet gnodet requested a review from mthmulders January 17, 2023 12:58
This reverts commit 7421d07.

# Conflicts:
#	maven-core/src/main/java/org/apache/maven/ReactorReader.java
@mthmulders
Copy link
Copy Markdown
Contributor

... in order to be able to partially run mvn test.

I'm not sure I understand. You mean "run mvn test on a multi-module project without requiring the user to have ran mvn package first"?

@michael-o michael-o removed their request for review January 17, 2023 20:22
@gnodet
Copy link
Copy Markdown
Contributor Author

gnodet commented Jan 17, 2023

... in order to be able to partially run mvn test.

I'm not sure I understand. You mean "run mvn test on a multi-module project without requiring the user to have ran mvn package first"?

Yes. I haven't removed this part in this PR. If the main artifacts have not been packaged, they will point to the target/classes.

Copy link
Copy Markdown
Contributor

@MartinKanters MartinKanters left a comment

Choose a reason for hiding this comment

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

I like the solution in general. Added small comments.

Comment thread maven-core/src/main/java/org/apache/maven/ReactorReader.java Outdated
Comment thread maven-core/src/main/java/org/apache/maven/ReactorReader.java Outdated
Comment thread maven-core/src/main/java/org/apache/maven/ReactorReader.java Outdated
Co-authored-by: Martin Kanters <mkanters93@gmail.com>
@gnodet
Copy link
Copy Markdown
Contributor Author

gnodet commented Jan 18, 2023

... in order to be able to partially run mvn test.

I'm not sure I understand. You mean "run mvn test on a multi-module project without requiring the user to have ran mvn package first"?

Yes. I haven't removed this part in this PR. If the main artifacts have not been packaged, they will point to the target/classes.

I've been able to remove the check to load the packaged artifacts.

@gnodet
Copy link
Copy Markdown
Contributor Author

gnodet commented Jan 18, 2023

In the internal project local repository structure, I've added a child directory with the version of a given artifact. This gives a structure which is closer to the maven local repository, and it allows deleting artifacts during the clean phase without having to rely on a heuristic to split between classifier / version / extension.

@mthmulders @MartinKanters I'm done on this PR, so unless you have further comments, an approval before the merge would be nice !

Comment thread maven-core/src/main/java/org/apache/maven/ReactorReader.java Outdated
Comment thread maven-core/src/main/java/org/apache/maven/ReactorReader.java Outdated
Copy link
Copy Markdown
Contributor

@MartinKanters MartinKanters left a comment

Choose a reason for hiding this comment

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

Looks like an elegant solution to me. Nice job.

Copy link
Copy Markdown
Contributor

@mthmulders mthmulders left a comment

Choose a reason for hiding this comment

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

I've been able to remove the check to load the packaged artifacts.

Awesome.

In the internal project local repository structure, I've added a child directory with the version of a given artifact. This gives a structure which is closer to the maven local repository, and it allows deleting artifacts during the clean phase without having to rely on a heuristic to split between classifier / version / extension.

Also awesome.

Happy to see this improvement. Thanks a lot @gnodet!

@gnodet gnodet merged commit c1a9001 into apache:master Jan 19, 2023
@gnodet gnodet added this to the 4.0.0-alpha-4 milestone Jan 19, 2023
@gnodet gnodet deleted the MNG-7629-alternative branch January 25, 2023 13:20
@jira-importer
Copy link
Copy Markdown

Resolve #8824

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.

5 participants