2020import org .openrewrite .Issue ;
2121import org .openrewrite .test .RecipeSpec ;
2222import org .openrewrite .test .RewriteTest ;
23- import org .openrewrite .test .SourceSpec ;
2423
2524import static org .openrewrite .java .Assertions .mavenProject ;
2625import static org .openrewrite .maven .Assertions .pomXml ;
@@ -123,74 +122,64 @@ void basicWithVariables() {
123122 }
124123
125124 @ Test
126- void overrideRemoteParent () {
125+ void updateLocalParent () {
127126 rewriteRun (
128- //language=xml
129- pomXml (
130- """
131- <project>
132- <groupId>com.example</groupId>
133- <artifactId>example-parent</artifactId>
134- <version>1.0.0</version>
135- <modelVersion>4.0</modelVersion>
136- <properties>
137- <java.version>11</java.version>
138- <jdk.version>11</jdk.version>
139- <javaVersion>11</javaVersion>
140- <jdkVersion>11</jdkVersion>
141- <maven.compiler.source>11</maven.compiler.source>
142- <maven.compiler.target>11</maven.compiler.target>
143- <maven.compiler.release>11</maven.compiler.release>
144- <release.version>11</release.version>
145- </properties>
146- </project>
147- """ ,
148- SourceSpec ::skip ),
149- mavenProject ("example-child" ,
150127 //language=xml
151128 pomXml (
152- """
153- <project>
154- <parent>
155- <groupId>com.example</groupId>
156- <artifactId>example-parent</artifactId>
157- <version>1.0.0</version>
158- <!-- lookup parent from remote repository -->
159- <relativePath/>
160- </parent>
161- <groupId>com.example</groupId>
162- <artifactId>example-child</artifactId>
163- <version>1.0.0</version>
164- <modelVersion>4.0</modelVersion>
165- </project>
166- """ ,
167- """
129+ """
130+ <project>
131+ <groupId>com.example</groupId>
132+ <artifactId>example-parent</artifactId>
133+ <version>1.0.0</version>
134+ <modelVersion>4.0</modelVersion>
135+ <properties>
136+ <java.version>11</java.version>
137+ <jdk.version>11</jdk.version>
138+ <javaVersion>11</javaVersion>
139+ <jdkVersion>11</jdkVersion>
140+ <maven.compiler.source>11</maven.compiler.source>
141+ <maven.compiler.target>11</maven.compiler.target>
142+ <maven.compiler.release>11</maven.compiler.release>
143+ <release.version>11</release.version>
144+ </properties>
145+ </project>
146+ """ ,
147+ """
168148 <project>
169- <parent>
170- <groupId>com.example</groupId>
171- <artifactId>example-parent</artifactId>
172- <version>1.0.0</version>
173- <!-- lookup parent from remote repository -->
174- <relativePath/>
175- </parent>
176149 <groupId>com.example</groupId>
177- <artifactId>example-child </artifactId>
150+ <artifactId>example-parent </artifactId>
178151 <version>1.0.0</version>
179152 <modelVersion>4.0</modelVersion>
180153 <properties>
181154 <java.version>17</java.version>
182- <javaVersion>17</javaVersion>
183155 <jdk.version>17</jdk.version>
156+ <javaVersion>17</javaVersion>
184157 <jdkVersion>17</jdkVersion>
185- <maven.compiler.release>17</maven.compiler.release>
186158 <maven.compiler.source>17</maven.compiler.source>
187159 <maven.compiler.target>17</maven.compiler.target>
160+ <maven.compiler.release>17</maven.compiler.release>
188161 <release.version>17</release.version>
189162 </properties>
190163 </project>
191- """
164+ """ ),
165+ mavenProject ("example-child" ,
166+ //language=xml
167+ pomXml (
168+ """
169+ <project>
170+ <parent>
171+ <groupId>com.example</groupId>
172+ <artifactId>example-parent</artifactId>
173+ <version>1.0.0</version>
174+ </parent>
175+ <groupId>com.example</groupId>
176+ <artifactId>example-child</artifactId>
177+ <version>1.0.0</version>
178+ <modelVersion>4.0</modelVersion>
179+ </project>
180+ """
181+ )
192182 )
193- )
194183 );
195184 }
196185
@@ -270,7 +259,7 @@ void springBoot3ParentToJava17() {
270259 <version>3.3.3</version>
271260 <relativePath/> <!-- lookup parent from repository -->
272261 </parent>
273-
262+
274263 <groupId>com.mycompany.app</groupId>
275264 <artifactId>my-app</artifactId>
276265 <version>1</version>
@@ -295,7 +284,7 @@ void springBoot3ParentToJava21() {
295284 <version>3.3.3</version>
296285 <relativePath/> <!-- lookup parent from repository -->
297286 </parent>
298-
287+
299288 <groupId>com.mycompany.app</groupId>
300289 <artifactId>my-app</artifactId>
301290 <version>1</version>
@@ -311,7 +300,7 @@ void springBoot3ParentToJava21() {
311300 <version>3.3.3</version>
312301 <relativePath/> <!-- lookup parent from repository -->
313302 </parent>
314-
303+
315304 <groupId>com.mycompany.app</groupId>
316305 <artifactId>my-app</artifactId>
317306 <version>1</version>
0 commit comments