Skip to content

Commit 82fb604

Browse files
committed
Consistently place version after artifactId in DoesNotIncludeDependency
1 parent d8249ce commit 82fb604

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

rewrite-maven/src/main/java/org/openrewrite/maven/search/DoesNotIncludeDependency.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ public class DoesNotIncludeDependency extends Recipe {
3939
example = "guava")
4040
String artifactId;
4141

42+
@Option(displayName = "Version",
43+
description = "Match only dependencies with the specified version. " +
44+
"Node-style [version selectors](https://docs.openrewrite.org/reference/dependency-version-selectors) may be used. " +
45+
"All versions are searched by default.",
46+
example = "1.x",
47+
required = false)
48+
@Nullable
49+
String version;
50+
4251
@Option(displayName = "Only direct dependencies",
4352
description = "Default false. If enabled, transitive dependencies will not be considered.",
4453
required = false,
@@ -54,15 +63,6 @@ public class DoesNotIncludeDependency extends Recipe {
5463
@Nullable
5564
String scope;
5665

57-
@Option(displayName = "Version",
58-
description = "Match only dependencies with the specified version. " +
59-
"Node-style [version selectors](https://docs.openrewrite.org/reference/dependency-version-selectors) may be used. " +
60-
"All versions are searched by default.",
61-
example = "1.x",
62-
required = false)
63-
@Nullable
64-
String version;
65-
6666
@Override
6767
public String getDisplayName() {
6868
return "Does not include Maven dependency";

rewrite-maven/src/test/java/org/openrewrite/maven/search/DoesNotIncludeDependencyTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ class DoesNotIncludeDependencyTest implements RewriteTest {
4343
""";
4444

4545
private Recipe defaultRecipeWithOnlyDirectAndScope(@Nullable Boolean onlyDirect, @Nullable String scope) {
46-
return new DoesNotIncludeDependency("org.springframework", "spring-beans", onlyDirect, scope, null);
46+
return new DoesNotIncludeDependency("org.springframework", "spring-beans", null, onlyDirect, scope);
4747
}
4848

4949
private Recipe defaultRecipeWithOnlyDirectAndVersion(@Nullable Boolean onlyDirect, @Nullable String version) {
50-
return new DoesNotIncludeDependency("org.springframework", "spring-beans", onlyDirect, null, version);
50+
return new DoesNotIncludeDependency("org.springframework", "spring-beans", version, onlyDirect, null);
5151
}
5252

5353
private String wrappedScope(String scope) {
@@ -58,7 +58,7 @@ private String wrappedScope(String scope) {
5858
@Test
5959
void dependencyPresentTransitivelyWithoutScopeOrDesiredScopeSpecifiedButDirectOnlyMarked() {
6060
rewriteRun(
61-
spec -> spec.recipe(new DoesNotIncludeDependency("org.springframework", "spring-beans", true, null, null)),
61+
spec -> spec.recipe(new DoesNotIncludeDependency("org.springframework", "spring-beans", null, true, null)),
6262
pomXml(
6363
"""
6464
<project>

0 commit comments

Comments
 (0)