Sun, 10 Sep 2023 12:59:04 +0200
add simple SLF4J provider - fixes #292
pom.xml | file | annotate | diff | comparison | revisions | |
src/main/java/de/unixwork/uwproj/Main.java | file | annotate | diff | comparison | revisions |
--- a/pom.xml Sun Sep 10 12:52:10 2023 +0200 +++ b/pom.xml Sun Sep 10 12:59:04 2023 +0200 @@ -16,6 +16,15 @@ <version>2.3</version> </dependency> <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-simple</artifactId> + <!-- Velocity depends on SLF4J 1.7, + so do NOT upgrade this version unless + velocity does! + --> + <version>1.7.36</version> + </dependency> + <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter</artifactId> <version>5.10.0</version>
--- a/src/main/java/de/unixwork/uwproj/Main.java Sun Sep 10 12:52:10 2023 +0200 +++ b/src/main/java/de/unixwork/uwproj/Main.java Sun Sep 10 12:59:04 2023 +0200 @@ -2,6 +2,7 @@ import org.apache.velocity.VelocityContext; import org.apache.velocity.app.VelocityEngine; +import org.slf4j.LoggerFactory; import java.io.*; @@ -27,7 +28,7 @@ new VelocityEngine().getTemplate(tplFileName).merge(context, out); } - public static void main(String[] args){ + public static void main(String[] args) { final var inFileName = "make/project.xml"; final var tplFileName = "make/configure.vm"; final var outFileName = "configure"; @@ -35,10 +36,12 @@ try (var out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFileName)))) { writeConfigureScript(out, tplFileName, loadProjectFile(inFileName)); } catch (Exception ex) { - ex.printStackTrace(); - System.exit(1); + LoggerFactory.getLogger(Main.class).error( + "Uncaught Exception", + ex + ); } - System.out.println("Out: "+outFileName); + System.out.println("Out: " + outFileName); } }