Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/main/resources/META-INF/rewrite/ibm-java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,14 @@ recipeList:
groupId: javax.activation
artifactId: activation
newConfiguration: compileOnly
---
type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.migrate.WasDevMvnChangeParentArtifactId
displayName: Change `net.wasdev.maven.parent:java8-parent` to `:parent`
description: This recipe changes the artifactId of the `<parent>` tag in the `pom.xml` from `java8-parent` to `parent`.
recipeList:
- org.openrewrite.maven.ChangeParentPom:
oldGroupId: net.wasdev.maven.parent
oldArtifactId: java8-parent
newArtifactId: parent
newVersion: 1.4
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Copyright 2025 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openrewrite.java.migrate;

import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
import org.openrewrite.test.RewriteTest;

import static org.openrewrite.maven.Assertions.pomXml;

class WasDevMvnChangeParentArtifactIdTest implements RewriteTest {

@DocumentExample
@Test
void mvnChangeParentArtifactId() {
rewriteRun(
spec -> spec.recipeFromResources("org.openrewrite.java.migrate.WasDevMvnChangeParentArtifactId"),
//language=XML
pomXml(
"""
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.wasdev.maven.parent</groupId>
<artifactId>java8-parent</artifactId>
<version>1.4</version>
</parent>
<artifactId>my-artifact</artifactId>
</project>
""",
"""
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.wasdev.maven.parent</groupId>
<artifactId>parent</artifactId>
<version>1.4</version>
</parent>
<artifactId>my-artifact</artifactId>
</project>
"""
)
);
}

@Test
void noChangeParentArtifactId() {
rewriteRun(
spec -> spec.recipeFromResources("org.openrewrite.java.migrate.WasDevMvnChangeParentArtifactId"),
//language=XML
pomXml(
"""
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.wasdev.maven.parent</groupId>
<artifactId>parent</artifactId>
<version>1.4</version>
</parent>
<artifactId>my-artifact</artifactId>
</project>
"""
)
);
}
}