From 160ceb5dba7715ffdffe92d764bf571c441862fb Mon Sep 17 00:00:00 2001 From: Benjamin Culkin Date: Sat, 18 May 2024 21:24:30 -0400 Subject: Get things working on a basic level --- src/main/java/com/ashardalon/maven/tomcat/TomcatMojo.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/ashardalon/maven/tomcat/TomcatMojo.java b/src/main/java/com/ashardalon/maven/tomcat/TomcatMojo.java index 0a5198d..bf9a9fa 100644 --- a/src/main/java/com/ashardalon/maven/tomcat/TomcatMojo.java +++ b/src/main/java/com/ashardalon/maven/tomcat/TomcatMojo.java @@ -64,12 +64,14 @@ public class TomcatMojo extends AbstractMojo { private String serverURL; @Parameter(defaultValue = "/${project.build.finalName}", property = "appPath", required = false) private String appPath; + @Parameter(defaultValue = "false", property = "update", required = false) + private String update; public void execute() throws MojoExecutionException { Path propFile = Paths.get(System.getProperty("user.home"), ".m2", "settings.xml"); URL url; try { - url = new URL(serverURL + "/manager/text/deploy?path=" + appPath); + url = new URL(serverURL + "/manager/text/deploy?update=" + Boolean.valueOf(update) + "&path=" + appPath); } catch (MalformedURLException e) { throw new MojoExecutionException("Error creating target URL", e); } @@ -112,13 +114,11 @@ public class TomcatMojo extends AbstractMojo { switch (responseCode) { case 200: BufferedReader bis = new BufferedReader(new InputStreamReader(conn.getInputStream())); - char[] buff = new char[4]; + char[] buff = new char[256]; int num = bis.read(buff); - if (num == 2) { // OK + if (buff[0] == 'O' && buff[1] == 'K') { // OK break; } else { // FAIL - buff = new char[256]; - num = bis.read(buff); throw new MojoExecutionException("Attempt to deploy app failed: " + new String(buff)); } case 401: -- cgit v1.2.3