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-6533] Test: ProjectBuildingException miss reference to MavenProject #197

Closed
wants to merge 3 commits into from

Conversation

mickaelistria
Copy link
Contributor

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.

@mickaelistria mickaelistria force-pushed the MNG-6533 branch 4 times, most recently from bf18b96 to ff2a6de Compare November 30, 2018 10:37
@@ -84,4 +87,52 @@ public void testVersionlessManagedDependency()
// this is expected
}
}

Copy link
Member

Choose a reason for hiding this comment

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

please use common formatting: this will improve maintenance

import org.apache.maven.model.building.ModelSource;

public class ProjectBuilderTest
extends AbstractCoreMavenComponentTestCase
{
protected String getProjectsDirectory()
@Override
protected String getProjectsDirectory()
Copy link
Member

Choose a reason for hiding this comment

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

please replace tab with space

@mickaelistria
Copy link
Contributor Author

@hboutemy Thanks, I updated the change according to your comments (I could have missed some style stuff though).

@hboutemy
Copy link
Member

hboutemy commented Dec 27, 2018

@mickaelistria I reworked the PR, creating 2 initial little refactoring commits that make the later modification a lot easier to understand IMHO: see MNG-6533-2 branch
With that 2 commits, I now can understand the main "Prefer passing the interim project in ProjectBuildingResult" commit...
One little thing that I feel is not good: catch(Exception) in the last commit. is catching InvalidArtifactRTException not sufficient?

@mickaelistria
Copy link
Contributor Author

I reworked the PR, creating 2 initial little refactoring commits that make the later modification a lot easier to understand IMHO: see MNG-6533-2 branch. With that 2 commits, I now can understand the main "Prefer passing the interim project in ProjectBuildingResult" commit...

Ok, thanks.

One little thing that I feel is not good: catch(Exception) in the last commit. is catching InvalidArtifactRTException not sufficient?

IIRC, there were some cases where this wasn't sufficient and some other exceptions could happen in m2e using this API; but I don't remember how much this memory is true; so I need to double-check.
I'll give it a try with catch (InvalidArtifactRTException) and see how m2e likes it or not on next Monday hopefully. If it seems to work as expected for m2e, I'm fine with changing it. If it doesn't I'll try to write extra-unit tests for the potential issues that are not covered by this exception.

@mickaelistria
Copy link
Contributor Author

@hboutemy I'm trying to get back to work on that one, but with MNG-6530, it's much harder to test it properly in m2e (I need to deal with a sequence of commits in the right order both in Maven and m2e to be able to test this issue). I'll try to make progress anyway, but it'd be much simpler to me if we can work on MNG-6530 first.

Initialize the interim project with "simple" items (ie do not build
not reference parent if it's not yet in the projectIndex) and returns
it when installation fails further.
This give a partial validation of the file, pretty convenient in IDEs.
Sending ModelProblems allows to keep processing other pom files.
@mickaelistria
Copy link
Contributor Author

@hboutemy Sorry for reporting so late. It's not an easy task and I'm not progressing very fast with this refactoring in m2e and have hard time to test things properly.
According to my last attempts, just catching ArtifactRTException as you suggested seems enough for the tests we have. I think one good approach is just to make the modification you suggest and merge it. If later I find some other cases, I'll open other issues and create new patches.
Does that seem good to you? Do you want to take care of making the change so it's your name marked on this change, which seems pretty fair ;)

@hboutemy
Copy link
Member

@mickaelistria no problem
I rebased the branch on current master, fixing the conflict, then added one commit to reduce from Exception to InvalidArtifactRTException

please review and tell me what you think about it before we review on the mailing list for merge to master

@mickaelistria
Copy link
Contributor Author

All good to me. I'd be happy to see this merged and then a snapshot published.
Then if I see further concerns, I'll open other tickets with narrower scope.

@hboutemy
Copy link
Member

merged to master
thank you for this hard contribution: I hope this won't be the last :)

@hboutemy hboutemy closed this Jan 15, 2019
@hboutemy hboutemy self-assigned this Jan 15, 2019
gnodet added a commit to gnodet/maven that referenced this pull request Nov 20, 2024
Follow up to bd25080 which missed a few tests using the above pattern
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