org.openrewrite.maven.UpgradeParentVersion
adds <project.artifactId>null</project.artifactId>
as Maven property
#4122
Labels
bug
Something isn't working
Description of issue
When running the
org.openrewrite.maven.UpgradeParentVersion
recipe, any properties that are used in the pom, for example,project.artifactId
but are not explicitly defined with that name, are added to the properties tag in the pom and are assigned a null value.in our project, the following structure is used to define the
project.artifactId
:so while
project.artifactId
has not been defined with that exact key, it has been defined through the xml structure, meaning it does not need to be redefined in propertiesThis issues seems to have been introduced with this commit, and I think all that needs to be done is to also check that properties in use have not been defined via the structure of the pom, in addition to the current check for the existence of the property on line 105
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am using Maven plugin through command-line to run a custom recipe list, and my project is a single module project.
Project is private so can't share snippets
What is the smallest, simplest way to reproduce the problem?
Create a pom file using a parent pom, with project, artifactId, and sonar.projectKey as follows:
I don't think this is specific to
sonar.projectKey
, just anything using the property project.artifactId, or any other properties that aren't defined using dots, but rather are defined by the structure of the xmlRun a recipe that includes the below recipe on a project with a
pom.xml
that resembles the above.What did you expect to see?
The parent pom upgraded to the specified version, and no other changes
What did you see instead?
The parent pom upgraded to the specified version, and a new property in the pom;
<project.artifactId>null<project.artifactId>
Are you interested in contributing a fix to OpenRewrite?
Would like to but may not have the knowledge off the bat
The text was updated successfully, but these errors were encountered: