Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-6716] Test and fix erroneous compileRoots #274

Closed
wants to merge 1 commit into from

Conversation

mickaelistria
Copy link
Contributor

@mickaelistria mickaelistria commented Aug 1, 2019

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a JIRA issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [MNG-XXX] - Fixes bug in ApproximateQuantiles,
    where you replace MNG-XXX with the appropriate JIRA issue. Best practice
    is to use the JIRA issue title in the pull request title and in the first line of the
    commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the Core IT successfully.

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@michael-o
Copy link
Member

I am trying to understand the fix, but I don't. Although if I look at the bug report the OP add the same path twice in different representations. How does this fix address this?

@mickaelistria
Copy link
Contributor Author

The comment in the code tries to explain it, but probably not that well.
I'll try again here and once we found the right words, or a better fix, I'll update the PR to makes things clearer.

So the point is that there are 2 passes done to build a MavenProject. It was the case before the changes I made first. Before my change, the project built on 1st pass was build with "raw" values (no resolution as parent wasn't set) was discarded and a new project was then build on 2nd pass (with some resolved values) using the result of the 1st pass, but really creating new objects.
That had some flows identified in other tickets, so I changed it so the project of 1st pass is reused in 2nd pass.
However, the issue it caused for MNG-6716 is that for some "fields" of the MavenProject -like the testCompileSourceRoots-, the 2nd pass wasn't replacing the values of the 1st one but was instead appending its values to the result of 1st pass. However, for most of the fields, the result of 1st pass are irrelevant because values are not resolved (read in this case path are not resolved to absolute ones) and shouldn't be set on the project because they're useless at that time.
That's what the patch does: when the value seem incomplete, we don't set them and they will be set on the 2nd pass.

Now I'm writing that, I think the fix is a bit weak. In general, we should instead identify what needs to be set on 1st pass and only set that, nothing more; and then on 2nd pass, set the other things.
However, changing that seems like a huge and risky work compared to the current patch.

Recent changes in ProjectBuilder make that the compile roots could be
set erroneously on 1st phase and propagated in the results.
This patch just skips setting the compile source root in the 1st pass
(when buildParentIfNonExisting==false).

It also tests some other fields of MavenProject
@mickaelistria
Copy link
Contributor Author

@michael-o I gave a try to another approach that's hopefully cleaner and easier to understand. The commit was updated and is ready for a new review.

@michael-o
Copy link
Member

@rfscholte Can you drop some lines? I guess don't know that part of code to apply proper judgement here.

@rfscholte
Copy link
Contributor

@michael-o your guess is as good as mine. It seems like these sourceRoots already have a special meaning, which might look like a design flaw in the MavenProject class (something to look at with Maven4 / Maven-API), however that doesn't help with the regression.
This fix does reflect that only some parts of the pom are having issues since 3.6.1. So ensure the unittest and ITs still work and let the reporter verify it on his project.

@michael-o
Copy link
Member

OK, I will push a branch and we'll see how far we get.

@michael-o
Copy link
Member

ITs are running...

asfgit pushed a commit that referenced this pull request Aug 3, 2019
Recent changes in ProjectBuilder make that the compile roots could be
set erroneously on 1st phase and propagated in the results.
This patch just skips setting the compile source root in the 1st pass
(when buildParentIfNonExisting==false).

It also tests some other fields of MavenProject

This closes #274
@michael-o
Copy link
Member

It passes locally for me, but does not show up on Jekins. Any idea?

@rfscholte
Copy link
Contributor

I had that issue too. Trick is to hit "Scan Multibranch Pipeline Now" in Jenkins to force it manually. Need to investigate the cause

@michael-o
Copy link
Member

So all ITs have passed on Jenkins. @mickaelistria Would you be so kind and test this out with the sample project of the reporter since he's offline for some while. If all is well, I will merge. If @rfscholte does not mind.

@mickaelistria
Copy link
Contributor Author

I already tested it before submittinh the patch and the probable cause is fixed.bit I was never able to reproduce the actual symptom on Linux.

@rfscholte
Copy link
Contributor

It looks like we're still suffering from issues from last week, https://builds.apache.org/job/maven-box/job/maven/job/MNG-6716/ is unstable. I would prefer a stable Maven before starting to merge new fixes.

@hboutemy
Copy link
Member

  1. I was able to reproduce the issue (on a Mac),
  2. I was able to check that the PR fixes the issue,
  3. I re-launched the build; and it now passes: https://builds.apache.org/job/maven-box/job/maven/job/MNG-6716/

everything looks ok to merge to master (and be able to launch 3.6.2 release process), isn't it?

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

#shipit

@michael-o
Copy link
Member

@hboutemy, I trust your judgement. If you bless, I'll do it too.

@hboutemy
Copy link
Member

@michael-o you asked (on the Jira issue) the user to check that the PR fixed the issue: I did it
Robert wanted to see a green build: it is there
I personally don't get more the content of the fix than you and Robert: I'm ok with you on "merge when ev erything is green"

@michael-o
Copy link
Member

@hboutemy, let's go for it!

@Tibor17
Copy link
Contributor

Tibor17 commented Aug 19, 2019

It looks like we're still suffering from issues from last week, https://builds.apache.org/job/maven-box/job/maven/job/MNG-6716/ is unstable. I would prefer a stable Maven before starting to merge new fixes.

It should be a good rule in every project that we would push PR before and after green Jenkins. Even some companies have a semaphore in the rooms and they stop the development if the build fails and they fix the build together. So there's only single failure to investigate at most.

@eolivelli eolivelli closed this in b65e846 Aug 19, 2019
@eolivelli
Copy link
Contributor

committed to master branch, thank you @mickaelistria
I feel we are ready to cut 3.6.2

@Tibor17
Copy link
Contributor

Tibor17 commented Aug 19, 2019 via email

gnodet added a commit to gnodet/maven that referenced this pull request Nov 20, 2024
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.

6 participants