Skip to content

Commit a2a1ff5

Browse files
committed
TestProjectContext allows adding Maven build files with given module path with or without filename
1 parent fb4c5b3 commit a2a1ff5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

components/sbm-core/src/test/java/org/springframework/sbm/project/resource/TestProjectContext.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,15 @@ public Builder withMavenBuildFileSource(Path path, String pomSource) {
393393
return this;
394394
}
395395

396+
public Builder withMavenBuildFileSource(String sourceDir, String pomSource) {
397+
Path sourcePath = Path.of(sourceDir);
398+
if(!sourceDir.endsWith("pom.xml")) {
399+
sourcePath = sourcePath.resolve("pom.xml");
400+
}
401+
this.addProjectResource(sourcePath, pomSource);
402+
return this;
403+
}
404+
396405
public Builder withMockedBuildFile(OpenRewriteMavenBuildFile mockedBuildFile) {
397406
if (containsAnyPomXml() || !dependencyCoordinates.isEmpty())
398407
throw new IllegalArgumentException("ProjectContext already contains pom.xml files.");

0 commit comments

Comments
 (0)