[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. |
eolivelli
left a comment
There was a problem hiding this comment.
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)
| // copy fields | ||
| setFile( project.getFile() ); | ||
| file = project.file; | ||
| basedir = project.basedir; |
There was a problem hiding this comment.
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.
|
Resolve #7456 |
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.