-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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-6405] Fix basedir in MavenProject.deepCopy #225
Conversation
Looks like this is very easy to verify with a unittest, so can you add it? |
I can add a unit test if you like. I am not sure that is going to be the most convincing demonstration that the reported bug is fixed, but it is something. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, can you add the unit test as discussed above ?
IMHO it's a bit nitpicking to require test for such change... |
I am looking into a test. By the way, as far as I can tell |
Failure without patch: junit.framework.AssertionFailedError: Base directory is preserved across clone expected:<…/maven-core/target/test-classes> but was:<…/maven-core/target/test-classes/target> at org.apache.maven.project.MavenProjectTest.testCloneWithBaseDir(MavenProjectTest.java:188)
@@ -1207,7 +1207,8 @@ private void deepCopy( MavenProject project ) | |||
// disown the parent | |||
|
|||
// copy fields | |||
setFile( project.getFile() ); | |||
file = project.file; | |||
basedir = project.basedir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that these assignments are actually unnecessary when called from clone
, since the fields are already set correctly by super.clone
. They would however be needed if called from MavenProject.<init>(MavenProject)
; since that copy constructor is apparently neither called anywhere in Maven itself nor tested, I wonder if it even works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
MNG-6405 since mojohaus/flatten-maven-plugin#53 (comment) brought this up again. I have not received any hints on the proper approach to test this.
By the way
Is this not already done by the
Jenkinsfile
? Maybe an obsolete PR template.