From c933f16e0f1357b01cb2c6fb5b6b44c9dd2f28c1 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 16 Aug 2023 12:10:49 -0700 Subject: [PATCH] Make PomBuilder.generateInto(File) static --- src/main/java/rife/bld/publish/PomBuilder.java | 9 +++++---- src/test/java/rife/bld/publish/TestPomBuilder.java | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/rife/bld/publish/PomBuilder.java b/src/main/java/rife/bld/publish/PomBuilder.java index 3f808ad..7d37afc 100644 --- a/src/main/java/rife/bld/publish/PomBuilder.java +++ b/src/main/java/rife/bld/publish/PomBuilder.java @@ -129,11 +129,12 @@ public String build() { * * @since 1.7.1 */ - public void generateInto(PublishInfo info, DependencyScopes dependencies, File file) + public static void generateInto(PublishInfo info, DependencyScopes dependencies, File file) throws FileUtilsErrorException { - info_ = info; - dependencies_ = dependencies; - FileUtils.writeString(build(), file); + var pomBuilder = new PomBuilder(); + pomBuilder.info_ = info; + pomBuilder.dependencies_ = dependencies; + FileUtils.writeString(pomBuilder.build(), file); } private void addDependencies(Template t, Scope scope) { diff --git a/src/test/java/rife/bld/publish/TestPomBuilder.java b/src/test/java/rife/bld/publish/TestPomBuilder.java index 715979d..268b26d 100644 --- a/src/test/java/rife/bld/publish/TestPomBuilder.java +++ b/src/test/java/rife/bld/publish/TestPomBuilder.java @@ -106,7 +106,7 @@ void testGenerateInto() throws IOException { var deps = new DependencyScopes(); deps.scope(Scope.compile).include(new Dependency("com.uwyn.rife2", "rife2")); - new PomBuilder().generateInto(new PublishInfo().name("the thing"), deps, temp); + PomBuilder.generateInto(new PublishInfo().name("the thing"), deps, temp); assertEquals("""